diff options
214 files changed, 6891 insertions, 4722 deletions
diff --git a/context/data/scite/context/lexers/data/scite-context-data-context.lua b/context/data/scite/context/lexers/data/scite-context-data-context.lua index f5929b52b..1a32fdf68 100644 --- a/context/data/scite/context/lexers/data/scite-context-data-context.lua +++ b/context/data/scite/context/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", "pluseleven", "plustwelve", "plussixteen", "plusfifty", "plushundred", "plusonehundred", "plustwohundred", "plusfivehundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxcount", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "centeringskip", "stretchingskip", "shrinkingskip", "centeringfillskip", "stretchingfillskip", "shrinkingfillskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "binaryshiftedten", "binaryshiftedtwenty", "binaryshiftedthirty", "thickermuskip", "directionlefttoright", "directionrighttoleft", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "prerollrun", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "texenginefunctionality", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "contextformat", "contextversion", "contextlmtxmode", "contextmark", "mksuffix", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "statuswrite", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "rlncatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "commaasciicode", "spaceasciicode", "periodasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "leftparentasciicode", "rightparentasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "hyphenasciicode", "percentasciicode", "leftbracketasciicode", "rightbracketasciicode", "hsizefrozenparcode", "skipfrozenparcode", "hangfrozenparcode", "indentfrozenparcode", "parfillfrozenparcode", "adjustfrozenparcode", "protrudefrozenparcode", "tolerancefrozenparcode", "stretchfrozenparcode", "loosenessfrozenparcode", "lastlinefrozenparcode", "linepenaltyfrozenparcode", "clubpenaltyfrozenparcode", "widowpenaltyfrozenparcode", "displaypenaltyfrozenparcode", "brokenpenaltyfrozenparcode", "demeritsfrozenparcode", "shapefrozenparcode", "linefrozenparcode", "hyphenationfrozenparcode", "shapingpenaltyfrozenparcode", "orphanpenaltyfrozenparcode", "allfrozenparcode", "mathpenaltyfrozenparcode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vadjustgroupcode", "vcentergroupcode", "mathabovegroupcode", "mathchoicegroupcode", "alsosimplegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "localboxgroupcode", "splitoffgroupcode", "splitkeepgroupcode", "preamblegroupcode", "alignsetgroupcode", "finrowgroupcode", "discretionarygroupcode", "markautomigrationcode", "insertautomigrationcode", "adjustautomigrationcode", "preautomigrationcode", "postautomigrationcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "overrulemathcontrolcode", "underrulemathcontrolcode", "radicalrulemathcontrolcode", "fractionrulemathcontrolcode", "accentskewhalfmathcontrolcode", "accentskewapplymathcontrolcode", "applyordinarykernpairmathcontrolcode", "applyverticalitalickernmathcontrolcode", "applyordinaryitalickernmathcontrolcode", "applycharitalickernmathcontrolcode", "reboxcharitalickernmathcontrolcode", "applyboxeditalickernmathcontrolcode", "staircasekernmathcontrolcode", "applytextitalickernmathcontrolcode", "applyscriptitalickernmathcontrolcode", "checkspaceitalickernmathcontrolcode", "checktextitalickernmathcontrolcode", "analyzescriptnucleuscharmathcontrolcode", "analyzescriptnucleuslistmathcontrolcode", "analyzescriptnucleusboxmathcontrolcode", "accenttopskewwithoffsetmathcontrolcode", "ignorekerndimensionsmathcontrolcode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noleftkerningglyphoptioncode", "noleftligaturingglyphoptioncode", "norightkerningglyphoptioncode", "norightligaturingglyphoptioncode", "noitaliccorrectionglyphoptioncode", "islargeoperatorglyphoptioncode", "hasitalicshapeglyphoptioncode", "normalparcontextcode", "vmodeparcontextcode", "vboxparcontextcode", "vtopparcontextcode", "vcenterparcontextcode", "vadjustparcontextcode", "insertparcontextcode", "outputparcontextcode", "alignparcontextcode", "noalignparcontextcode", "spanparcontextcode", "resetparcontextcode", "leftoriginlistanchorcode", "leftheightlistanchorcode", "leftdepthlistanchorcode", "rightoriginlistanchorcode", "rightheightlistanchorcode", "rightdepthlistanchorcode", "centeroriginlistanchorcode", "centerheightlistanchorcode", "centerdepthlistanchorcode", "halfwaytotallistanchorcode", "halfwayheightlistanchorcode", "halfwaydepthlistanchorcode", "halfwayleftlistanchorcode", "halfwayrightlistanchorcode", "negatexlistsigncode", "negateylistsigncode", "negatelistsigncode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "mathexheight", "mathemwidth", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathaxisheight", "muquad", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifelsemode", "doifmodeelse", "doifnotmode", "startmodeset", "stopmodeset", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifelseallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "unexpandeddocumentvariable", "setupdocument", "presetdocument", "doifelsedocumentvariable", "doifdocumentvariableelse", "doifdocumentvariable", "doifnotdocumentvariable", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule", "setupmodule", "currentmoduleparameter", "moduleparameter", "everystarttext", "everystoptext", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "definemode", "globalenablemode", "globaldisablemode", "globalpreventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordinarycode", "mathordcode", "mathoperatorcode", "mathopcode", "mathbinarycode", "mathbincode", "mathrelationcode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctuationcode", "mathpunctcode", "mathovercode", "mathundercode", "mathinnercode", "mathradicalcode", "mathfractioncode", "mathmiddlecode", "mathaccentcode", "mathfencedcode", "mathghostcode", "mathvariablecode", "mathactivecode", "mathvcentercode", "mathconstructcode", "mathwrappedcode", "mathbegincode", "mathendcode", "mathexplicitcode", "mathdivisioncode", "mathfactorialcode", "mathdimensioncode", "mathexperimentalcode", "mathtextpunctuationcode", "mathimaginarycode", "mathdifferentialcode", "mathexponentialcode", "mathellipsiscode", "mathfunctioncode", "mathdigitcode", "mathalphacode", "mathboxcode", "mathchoicecode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathunsetcode", "mathunspacedcode", "mathallcode", "mathfakecode", "mathunarycode", "mathmaybeordinarycode", "mathmayberelationcode", "mathmaybebinarycode", "mathnumbergroupcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "lrm", "rlm", "bidilre", "bidirle", "bidipop", "bidilro", "bidirlo", "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "enquad", "emquad", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar", "softhyphen", "Ux", "eUx", "Umathaccents", "parfillleftskip", "parfillrightskip", "startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode", "wildcardsymbol", "normalhyphenationcode", "automatichyphenationcode", "explicithyphenationcode", "syllablehyphenationcode", "uppercasehyphenationcode", "collapsehyphenationcode", "compoundhyphenationcode", "strictstarthyphenationcode", "strictendhyphenationcode", "automaticpenaltyhyphenationcode", "explicitpenaltyhyphenationcode", "permitgluehyphenationcode", "permitallhyphenationcode", "permitmathreplacehyphenationcode", "forcecheckhyphenationcode", "lazyligatureshyphenationcode", "forcehandlerhyphenationcode", "feedbackcompoundhyphenationcode", "ignoreboundshyphenationcode", "partialhyphenationcode", "completehyphenationcode", "normalizelinenormalizecode", "parindentskipnormalizecode", "swaphangindentnormalizecode", "swapparsshapenormalizecode", "breakafterdirnormalizecode", "removemarginkernsnormalizecode", "clipwidthnormalizecode", "flattendiscretionariesnormalizecode", "discardzerotabskipsnormalizecode", "flattenhleadersnormalizecode", "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode", "nopreslackclassoptioncode", "nopostslackclassoptioncode", "lefttopkernclassoptioncode", "righttopkernclassoptioncode", "leftbottomkernclassoptioncode", "rightbottomkernclassoptioncode", "lookaheadforendclassoptioncode", "noitaliccorrectionclassoptioncode", "defaultmathclassoptions", "checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode", "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", "preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode", "operatoritaliccorrectionclassoptioncode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noitaliccorrectionglyphoptioncode", "nokerningcode", "noligaturingcode", "frozenflagcode", "tolerantflagcode", "protectedflagcode", "primitiveflagcode", "permanentflagcode", "noalignedflagcode", "immutableflagcode", "mutableflagcode", "globalflagcode", "overloadedflagcode", "immediateflagcode", "conditionalflagcode", "valueflagcode", "instanceflagcode", "ordmathflattencode", "binmathflattencode", "relmathflattencode", "punctmathflattencode", "innermathflattencode", "normalworddiscoptioncode", "preworddiscoptioncode", "postworddiscoptioncode", "continueifinputfile", "continuewhenlmtxmode", "continuewhenmkivmode" }, + ["constants"]={ "zerocount", "minusone", "minustwo", "plusone", "plustwo", "plusthree", "plusfour", "plusfive", "plussix", "plusseven", "pluseight", "plusnine", "plusten", "pluseleven", "plustwelve", "plussixteen", "plusfifty", "plushundred", "plusonehundred", "plustwohundred", "plusfivehundred", "plusthousand", "plustenthousand", "plustwentythousand", "medcard", "maxcard", "maxcardminusone", "zeropoint", "onepoint", "halfapoint", "onebasepoint", "maxcount", "maxdimen", "scaledpoint", "thousandpoint", "points", "halfpoint", "zeroskip", "centeringskip", "stretchingskip", "shrinkingskip", "centeringfillskip", "stretchingfillskip", "shrinkingfillskip", "zeromuskip", "onemuskip", "pluscxxvii", "pluscxxviii", "pluscclv", "pluscclvi", "normalpagebox", "binaryshiftedten", "binaryshiftedtwenty", "binaryshiftedthirty", "thickermuskip", "directionlefttoright", "directionrighttoleft", "endoflinetoken", "outputnewlinechar", "emptytoks", "empty", "undefined", "prerollrun", "voidbox", "emptybox", "emptyvbox", "emptyhbox", "bigskipamount", "medskipamount", "smallskipamount", "fmtname", "fmtversion", "texengine", "texenginename", "texengineversion", "texenginefunctionality", "luatexengine", "pdftexengine", "xetexengine", "unknownengine", "contextformat", "contextversion", "contextlmtxmode", "contextmark", "mksuffix", "activecatcode", "bgroup", "egroup", "endline", "conditionaltrue", "conditionalfalse", "attributeunsetvalue", "statuswrite", "uprotationangle", "rightrotationangle", "downrotationangle", "leftrotationangle", "inicatcodes", "ctxcatcodes", "texcatcodes", "notcatcodes", "txtcatcodes", "vrbcatcodes", "prtcatcodes", "nilcatcodes", "luacatcodes", "tpacatcodes", "tpbcatcodes", "xmlcatcodes", "ctdcatcodes", "rlncatcodes", "escapecatcode", "begingroupcatcode", "endgroupcatcode", "mathshiftcatcode", "alignmentcatcode", "endoflinecatcode", "parametercatcode", "superscriptcatcode", "subscriptcatcode", "ignorecatcode", "spacecatcode", "lettercatcode", "othercatcode", "activecatcode", "commentcatcode", "invalidcatcode", "tabasciicode", "newlineasciicode", "formfeedasciicode", "endoflineasciicode", "endoffileasciicode", "commaasciicode", "spaceasciicode", "periodasciicode", "hashasciicode", "dollarasciicode", "commentasciicode", "ampersandasciicode", "colonasciicode", "backslashasciicode", "circumflexasciicode", "underscoreasciicode", "leftbraceasciicode", "barasciicode", "rightbraceasciicode", "tildeasciicode", "delasciicode", "leftparentasciicode", "rightparentasciicode", "lessthanasciicode", "morethanasciicode", "doublecommentsignal", "atsignasciicode", "exclamationmarkasciicode", "questionmarkasciicode", "doublequoteasciicode", "singlequoteasciicode", "forwardslashasciicode", "primeasciicode", "hyphenasciicode", "percentasciicode", "leftbracketasciicode", "rightbracketasciicode", "hsizefrozenparcode", "skipfrozenparcode", "hangfrozenparcode", "indentfrozenparcode", "parfillfrozenparcode", "adjustfrozenparcode", "protrudefrozenparcode", "tolerancefrozenparcode", "stretchfrozenparcode", "loosenessfrozenparcode", "lastlinefrozenparcode", "linepenaltyfrozenparcode", "clubpenaltyfrozenparcode", "widowpenaltyfrozenparcode", "displaypenaltyfrozenparcode", "brokenpenaltyfrozenparcode", "demeritsfrozenparcode", "shapefrozenparcode", "linefrozenparcode", "hyphenationfrozenparcode", "shapingpenaltyfrozenparcode", "orphanpenaltyfrozenparcode", "allfrozenparcode", "mathpenaltyfrozenparcode", "activemathcharcode", "activetabtoken", "activeformfeedtoken", "activeendoflinetoken", "batchmodecode", "nonstopmodecode", "scrollmodecode", "errorstopmodecode", "bottomlevelgroupcode", "simplegroupcode", "hboxgroupcode", "adjustedhboxgroupcode", "vboxgroupcode", "vtopgroupcode", "aligngroupcode", "noaligngroupcode", "outputgroupcode", "mathgroupcode", "discretionarygroupcode", "insertgroupcode", "vadjustgroupcode", "vcentergroupcode", "mathabovegroupcode", "mathchoicegroupcode", "alsosimplegroupcode", "semisimplegroupcode", "mathshiftgroupcode", "mathleftgroupcode", "localboxgroupcode", "splitoffgroupcode", "splitkeepgroupcode", "preamblegroupcode", "alignsetgroupcode", "finrowgroupcode", "discretionarygroupcode", "markautomigrationcode", "insertautomigrationcode", "adjustautomigrationcode", "preautomigrationcode", "postautomigrationcode", "charnodecode", "hlistnodecode", "vlistnodecode", "rulenodecode", "insertnodecode", "marknodecode", "adjustnodecode", "ligaturenodecode", "discretionarynodecode", "whatsitnodecode", "mathnodecode", "gluenodecode", "kernnodecode", "penaltynodecode", "unsetnodecode", "mathsnodecode", "overrulemathcontrolcode", "underrulemathcontrolcode", "radicalrulemathcontrolcode", "fractionrulemathcontrolcode", "accentskewhalfmathcontrolcode", "accentskewapplymathcontrolcode", "applyordinarykernpairmathcontrolcode", "applyverticalitalickernmathcontrolcode", "applyordinaryitalickernmathcontrolcode", "applycharitalickernmathcontrolcode", "reboxcharitalickernmathcontrolcode", "applyboxeditalickernmathcontrolcode", "staircasekernmathcontrolcode", "applytextitalickernmathcontrolcode", "applyscriptitalickernmathcontrolcode", "checkspaceitalickernmathcontrolcode", "checktextitalickernmathcontrolcode", "analyzescriptnucleuscharmathcontrolcode", "analyzescriptnucleuslistmathcontrolcode", "analyzescriptnucleusboxmathcontrolcode", "accenttopskewwithoffsetmathcontrolcode", "ignorekerndimensionsmathcontrolcode", "ignoreflataccentsmathcontrolcode", "extendaccentsmathcontrolcode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noleftkerningglyphoptioncode", "noleftligaturingglyphoptioncode", "norightkerningglyphoptioncode", "norightligaturingglyphoptioncode", "noitaliccorrectionglyphoptioncode", "islargeoperatorglyphoptioncode", "hasitalicshapeglyphoptioncode", "normalparcontextcode", "vmodeparcontextcode", "vboxparcontextcode", "vtopparcontextcode", "vcenterparcontextcode", "vadjustparcontextcode", "insertparcontextcode", "outputparcontextcode", "alignparcontextcode", "noalignparcontextcode", "spanparcontextcode", "resetparcontextcode", "leftoriginlistanchorcode", "leftheightlistanchorcode", "leftdepthlistanchorcode", "rightoriginlistanchorcode", "rightheightlistanchorcode", "rightdepthlistanchorcode", "centeroriginlistanchorcode", "centerheightlistanchorcode", "centerdepthlistanchorcode", "halfwaytotallistanchorcode", "halfwayheightlistanchorcode", "halfwaydepthlistanchorcode", "halfwayleftlistanchorcode", "halfwayrightlistanchorcode", "negatexlistsigncode", "negateylistsigncode", "negatelistsigncode", "fontslantperpoint", "fontinterwordspace", "fontinterwordstretch", "fontinterwordshrink", "fontexheight", "fontemwidth", "fontextraspace", "slantperpoint", "mathexheight", "mathemwidth", "interwordspace", "interwordstretch", "interwordshrink", "exheight", "emwidth", "extraspace", "mathaxisheight", "muquad", "startmode", "stopmode", "startnotmode", "stopnotmode", "startmodeset", "stopmodeset", "doifmode", "doifelsemode", "doifmodeelse", "doifnotmode", "startmodeset", "stopmodeset", "startallmodes", "stopallmodes", "startnotallmodes", "stopnotallmodes", "doifallmodes", "doifelseallmodes", "doifallmodeselse", "doifnotallmodes", "startenvironment", "stopenvironment", "environment", "startcomponent", "stopcomponent", "component", "startproduct", "stopproduct", "product", "startproject", "stopproject", "project", "starttext", "stoptext", "startnotext", "stopnotext", "startdocument", "stopdocument", "documentvariable", "unexpandeddocumentvariable", "setupdocument", "presetdocument", "doifelsedocumentvariable", "doifdocumentvariableelse", "doifdocumentvariable", "doifnotdocumentvariable", "startmodule", "stopmodule", "usemodule", "usetexmodule", "useluamodule", "setupmodule", "currentmoduleparameter", "moduleparameter", "everystarttext", "everystoptext", "startTEXpage", "stopTEXpage", "enablemode", "disablemode", "preventmode", "definemode", "globalenablemode", "globaldisablemode", "globalpreventmode", "pushmode", "popmode", "typescriptone", "typescripttwo", "typescriptthree", "mathsizesuffix", "mathordinarycode", "mathordcode", "mathoperatorcode", "mathopcode", "mathbinarycode", "mathbincode", "mathrelationcode", "mathrelcode", "mathopencode", "mathclosecode", "mathpunctuationcode", "mathpunctcode", "mathovercode", "mathundercode", "mathinnercode", "mathradicalcode", "mathfractioncode", "mathmiddlecode", "mathaccentcode", "mathfencedcode", "mathghostcode", "mathvariablecode", "mathactivecode", "mathvcentercode", "mathconstructcode", "mathwrappedcode", "mathbegincode", "mathendcode", "mathexplicitcode", "mathdivisioncode", "mathfactorialcode", "mathdimensioncode", "mathexperimentalcode", "mathtextpunctuationcode", "mathimaginarycode", "mathdifferentialcode", "mathexponentialcode", "mathellipsiscode", "mathfunctioncode", "mathdigitcode", "mathalphacode", "mathboxcode", "mathchoicecode", "mathnothingcode", "mathlimopcode", "mathnolopcode", "mathunsetcode", "mathunspacedcode", "mathallcode", "mathfakecode", "mathunarycode", "mathmaybeordinarycode", "mathmayberelationcode", "mathmaybebinarycode", "mathnumbergroupcode", "constantnumber", "constantnumberargument", "constantdimen", "constantdimenargument", "constantemptyargument", "luastringsep", "!!bs", "!!es", "lefttorightmark", "righttoleftmark", "lrm", "rlm", "bidilre", "bidirle", "bidipop", "bidilro", "bidirlo", "breakablethinspace", "nobreakspace", "nonbreakablespace", "narrownobreakspace", "zerowidthnobreakspace", "ideographicspace", "ideographichalffillspace", "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "enquad", "emquad", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", "optionalspace", "asciispacechar", "softhyphen", "autoinsertedspace", "Ux", "eUx", "Umathaccents", "parfillleftskip", "parfillrightskip", "startlmtxmode", "stoplmtxmode", "startmkivmode", "stopmkivmode", "wildcardsymbol", "normalhyphenationcode", "automatichyphenationcode", "explicithyphenationcode", "syllablehyphenationcode", "uppercasehyphenationcode", "collapsehyphenationcode", "compoundhyphenationcode", "strictstarthyphenationcode", "strictendhyphenationcode", "automaticpenaltyhyphenationcode", "explicitpenaltyhyphenationcode", "permitgluehyphenationcode", "permitallhyphenationcode", "permitmathreplacehyphenationcode", "forcecheckhyphenationcode", "lazyligatureshyphenationcode", "forcehandlerhyphenationcode", "feedbackcompoundhyphenationcode", "ignoreboundshyphenationcode", "partialhyphenationcode", "completehyphenationcode", "normalizelinenormalizecode", "parindentskipnormalizecode", "swaphangindentnormalizecode", "swapparsshapenormalizecode", "breakafterdirnormalizecode", "removemarginkernsnormalizecode", "clipwidthnormalizecode", "flattendiscretionariesnormalizecode", "discardzerotabskipsnormalizecode", "flattenhleadersnormalizecode", "normalizeparnormalizeparcode", "flattenvleadersnormalizeparcode", "nopreslackclassoptioncode", "nopostslackclassoptioncode", "lefttopkernclassoptioncode", "righttopkernclassoptioncode", "leftbottomkernclassoptioncode", "rightbottomkernclassoptioncode", "lookaheadforendclassoptioncode", "noitaliccorrectionclassoptioncode", "defaultmathclassoptions", "checkligatureclassoptioncode", "checkitaliccorrectionclassoptioncode", "checkkernpairclassoptioncode", "flattenclassoptioncode", "omitpenaltyclassoptioncode", "unpackclassoptioncode", "raiseprimeclassoptioncode", "carryoverlefttopkernclassoptioncode", "carryoverleftbottomkernclassoptioncode", "carryoverrighttopkernclassoptioncode", "carryoverrightbottomkernclassoptioncode", "preferdelimiterdimensionsclassoptioncode", "autoinjectclassoptioncode", "removeitaliccorrectionclassoptioncode", "operatoritaliccorrectionclassoptioncode", "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noleftligatureglyphoptioncode", "noleftkernglyphoptioncode", "norightligatureglyphoptioncode", "norightkernglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noitaliccorrectionglyphoptioncode", "nokerningcode", "noligaturingcode", "frozenflagcode", "tolerantflagcode", "protectedflagcode", "primitiveflagcode", "permanentflagcode", "noalignedflagcode", "immutableflagcode", "mutableflagcode", "globalflagcode", "overloadedflagcode", "immediateflagcode", "conditionalflagcode", "valueflagcode", "instanceflagcode", "ordmathflattencode", "binmathflattencode", "relmathflattencode", "punctmathflattencode", "innermathflattencode", "normalworddiscoptioncode", "preworddiscoptioncode", "postworddiscoptioncode", "continueifinputfile", "continuewhenlmtxmode", "continuewhenmkivmode" }, ["helpers"]={ "startsetups", "stopsetups", "startxmlsetups", "stopxmlsetups", "startluasetups", "stopluasetups", "starttexsetups", "stoptexsetups", "startrawsetups", "stoprawsetups", "startlocalsetups", "stoplocalsetups", "starttexdefinition", "stoptexdefinition", "starttexcode", "stoptexcode", "startcontextcode", "stopcontextcode", "startcontextdefinitioncode", "stopcontextdefinitioncode", "texdefinition", "doifelsesetups", "doifsetupselse", "doifsetups", "doifnotsetups", "setup", "setups", "texsetup", "xmlsetup", "luasetup", "directsetup", "fastsetup", "copysetups", "resetsetups", "doifelsecommandhandler", "doifcommandhandlerelse", "doifnotcommandhandler", "doifcommandhandler", "newmode", "setmode", "resetmode", "newsystemmode", "setsystemmode", "resetsystemmode", "pushsystemmode", "popsystemmode", "globalsetmode", "globalresetmode", "globalsetsystemmode", "globalresetsystemmode", "booleanmodevalue", "newcount", "newdimen", "newskip", "newmuskip", "newbox", "newtoks", "newread", "newwrite", "newmarks", "newinsert", "newattribute", "newif", "newlanguage", "newfamily", "newfam", "newhelp", "then", "begcsname", "autorule", "strippedcsname", "checkedstrippedcsname", "nofarguments", "firstargumentfalse", "firstargumenttrue", "secondargumentfalse", "secondargumenttrue", "thirdargumentfalse", "thirdargumenttrue", "fourthargumentfalse", "fourthargumenttrue", "fifthargumentfalse", "fifthargumenttrue", "sixthargumentfalse", "sixthargumenttrue", "seventhargumentfalse", "seventhargumenttrue", "vkern", "hkern", "vpenalty", "hpenalty", "doglobal", "dodoglobal", "redoglobal", "resetglobal", "donothing", "untraceddonothing", "dontcomplain", "moreboxtracing", "lessboxtracing", "noboxtracing", "forgetall", "donetrue", "donefalse", "foundtrue", "foundfalse", "inlineordisplaymath", "indisplaymath", "forcedisplaymath", "startforceddisplaymath", "stopforceddisplaymath", "startpickupmath", "stoppickupmath", "reqno", "forceinlinemath", "mathortext", "thebox", "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", "ruledhfilll", "ruledhfilneg", "ruledhfillneg", "normalhfillneg", "normalhfilllneg", "ruledvss", "ruledvfil", "ruledvfill", "ruledvfilll", "ruledvfilneg", "ruledvfillneg", "normalvfillneg", "normalvfilllneg", "ruledhbox", "ruledvbox", "ruledvtop", "ruledvcenter", "ruledmbox", "ruledhpack", "ruledvpack", "ruledtpack", "ruledhskip", "ruledvskip", "ruledkern", "ruledmskip", "ruledmkern", "ruledhglue", "ruledvglue", "normalhglue", "normalvglue", "ruledpenalty", "filledhboxb", "filledhboxr", "filledhboxg", "filledhboxc", "filledhboxm", "filledhboxy", "filledhboxk", "scratchstring", "scratchstringone", "scratchstringtwo", "tempstring", "scratchcounter", "globalscratchcounter", "privatescratchcounter", "scratchdimen", "globalscratchdimen", "privatescratchdimen", "scratchskip", "globalscratchskip", "privatescratchskip", "scratchmuskip", "globalscratchmuskip", "privatescratchmuskip", "scratchtoks", "globalscratchtoks", "privatescratchtoks", "scratchbox", "globalscratchbox", "privatescratchbox", "scratchmacro", "scratchmacroone", "scratchmacrotwo", "scratchconditiontrue", "scratchconditionfalse", "ifscratchcondition", "scratchconditiononetrue", "scratchconditiononefalse", "ifscratchconditionone", "scratchconditiontwotrue", "scratchconditiontwofalse", "ifscratchconditiontwo", "globalscratchcounterone", "globalscratchcountertwo", "globalscratchcounterthree", "groupedcommand", "groupedcommandcs", "triggergroupedcommand", "triggergroupedcommandcs", "simplegroupedcommand", "simplegroupedcommandcs", "pickupgroupedcommand", "pickupgroupedcommandcs", "mathgroupedcommandcs", "usedbaselineskip", "usedlineskip", "usedlineskiplimit", "availablehsize", "localhsize", "setlocalhsize", "distributedhsize", "hsizefraction", "next", "nexttoken", "nextbox", "dowithnextbox", "dowithnextboxcs", "dowithnextboxcontent", "dowithnextboxcontentcs", "flushnextbox", "boxisempty", "boxtostring", "contentostring", "prerolltostring", "givenwidth", "givenheight", "givendepth", "scangivendimensions", "scratchwidth", "scratchheight", "scratchdepth", "scratchoffset", "scratchdistance", "scratchtotal", "scratchitalic", "scratchhsize", "scratchvsize", "scratchxoffset", "scratchyoffset", "scratchhoffset", "scratchvoffset", "scratchxposition", "scratchyposition", "scratchtopoffset", "scratchbottomoffset", "scratchleftoffset", "scratchrightoffset", "scratchcounterone", "scratchcountertwo", "scratchcounterthree", "scratchcounterfour", "scratchcounterfive", "scratchcountersix", "scratchdimenone", "scratchdimentwo", "scratchdimenthree", "scratchdimenfour", "scratchdimenfive", "scratchdimensix", "scratchskipone", "scratchskiptwo", "scratchskipthree", "scratchskipfour", "scratchskipfive", "scratchskipsix", "scratchmuskipone", "scratchmuskiptwo", "scratchmuskipthree", "scratchmuskipfour", "scratchmuskipfive", "scratchmuskipsix", "scratchtoksone", "scratchtokstwo", "scratchtoksthree", "scratchtoksfour", "scratchtoksfive", "scratchtokssix", "scratchboxone", "scratchboxtwo", "scratchboxthree", "scratchboxfour", "scratchboxfive", "scratchboxsix", "scratchnx", "scratchny", "scratchmx", "scratchmy", "scratchunicode", "scratchmin", "scratchmax", "scratchleftskip", "scratchrightskip", "scratchtopskip", "scratchbottomskip", "doif", "doifnot", "doifelse", "firstinset", "doifinset", "doifnotinset", "doifelseinset", "doifinsetelse", "doifelsenextchar", "doifnextcharelse", "doifelsenextcharcs", "doifnextcharcselse", "doifelsenextoptional", "doifnextoptionalelse", "doifelsenextoptionalcs", "doifnextoptionalcselse", "doifelsefastoptionalcheck", "doiffastoptionalcheckelse", "doifelsefastoptionalcheckcs", "doiffastoptionalcheckcselse", "doifelsenextbgroup", "doifnextbgroupelse", "doifelsenextbgroupcs", "doifnextbgroupcselse", "doifelsenextparenthesis", "doifnextparenthesiselse", "doifelseundefined", "doifundefinedelse", "doifelsedefined", "doifdefinedelse", "doifundefined", "doifdefined", "doifelsevalue", "doifvalue", "doifnotvalue", "doifnothing", "doifsomething", "doifelsenothing", "doifnothingelse", "doifelsesomething", "doifsomethingelse", "doifvaluenothing", "doifvaluesomething", "doifelsevaluenothing", "doifvaluenothingelse", "doifelsedimension", "doifdimensionelse", "doifelsenumber", "doifnumberelse", "doifnumber", "doifnotnumber", "doifelsecommon", "doifcommonelse", "doifcommon", "doifnotcommon", "doifinstring", "doifnotinstring", "doifelseinstring", "doifinstringelse", "doifelseassignment", "doifassignmentelse", "docheckassignment", "doifelseassignmentcs", "doifassignmentelsecs", "validassignment", "novalidassignment", "doiftext", "doifelsetext", "doiftextelse", "doifnottext", "quitcondition", "truecondition", "falsecondition", "tracingall", "tracingnone", "loggingall", "tracingcatcodes", "showluatokens", "aliasmacro", "removetoks", "appendtoks", "prependtoks", "appendtotoks", "prependtotoks", "to", "endgraf", "endpar", "reseteverypar", "finishpar", "empty", "null", "space", "quad", "enspace", "emspace", "charspace", "nbsp", "crlf", "obeyspaces", "obeylines", "obeytabs", "obeypages", "obeyedspace", "obeyedline", "obeyedtab", "obeyedpage", "normalspace", "naturalspace", "controlspace", "normalspaces", "ignoretabs", "ignorelines", "ignorepages", "ignoreeofs", "setcontrolspaces", "executeifdefined", "singleexpandafter", "doubleexpandafter", "tripleexpandafter", "dontleavehmode", "removelastspace", "removeunwantedspaces", "keepunwantedspaces", "removepunctuation", "ignoreparskip", "forcestrutdepth", "onlynonbreakablespace", "wait", "writestatus", "define", "defineexpandable", "redefine", "setmeasure", "setemeasure", "setgmeasure", "setxmeasure", "definemeasure", "freezemeasure", "measure", "measured", "directmeasure", "setquantity", "setequantity", "setgquantity", "setxquantity", "definequantity", "freezequantity", "quantity", "quantitied", "directquantity", "installcorenamespace", "getvalue", "getuvalue", "setvalue", "setevalue", "setgvalue", "setxvalue", "letvalue", "letgvalue", "resetvalue", "undefinevalue", "ignorevalue", "setuvalue", "setuevalue", "setugvalue", "setuxvalue", "globallet", "udef", "ugdef", "uedef", "uxdef", "checked", "unique", "getparameters", "geteparameters", "getgparameters", "getxparameters", "forgetparameters", "copyparameters", "getdummyparameters", "dummyparameter", "directdummyparameter", "setdummyparameter", "letdummyparameter", "setexpandeddummyparameter", "usedummystyleandcolor", "usedummystyleparameter", "usedummycolorparameter", "processcommalist", "processcommacommand", "quitcommalist", "quitprevcommalist", "processaction", "processallactions", "processfirstactioninset", "processallactionsinset", "unexpanded", "expanded", "startexpanded", "stopexpanded", "protect", "unprotect", "firstofoneargument", "firstoftwoarguments", "secondoftwoarguments", "firstofthreearguments", "secondofthreearguments", "thirdofthreearguments", "firstoffourarguments", "secondoffourarguments", "thirdoffourarguments", "fourthoffourarguments", "firstoffivearguments", "secondoffivearguments", "thirdoffivearguments", "fourthoffivearguments", "fifthoffivearguments", "firstofsixarguments", "secondofsixarguments", "thirdofsixarguments", "fourthofsixarguments", "fifthofsixarguments", "sixthofsixarguments", "firstofoneunexpanded", "firstoftwounexpanded", "secondoftwounexpanded", "firstofthreeunexpanded", "secondofthreeunexpanded", "thirdofthreeunexpanded", "gobbleoneargument", "gobbletwoarguments", "gobblethreearguments", "gobblefourarguments", "gobblefivearguments", "gobblesixarguments", "gobblesevenarguments", "gobbleeightarguments", "gobbleninearguments", "gobbletenarguments", "gobbleoneoptional", "gobbletwooptionals", "gobblethreeoptionals", "gobblefouroptionals", "gobblefiveoptionals", "dorecurse", "doloop", "exitloop", "dostepwiserecurse", "recurselevel", "recursedepth", "dofastloopcs", "fastloopindex", "fastloopfinal", "dowith", "doloopovermatch", "doloopovermatched", "doloopoverlist", "newconstant", "setnewconstant", "setconstant", "setconstantvalue", "newconditional", "settrue", "setfalse", "settruevalue", "setfalsevalue", "setconditional", "newmacro", "setnewmacro", "newfraction", "newsignal", "newboundary", "dosingleempty", "dodoubleempty", "dotripleempty", "doquadrupleempty", "doquintupleempty", "dosixtupleempty", "doseventupleempty", "dosingleargument", "dodoubleargument", "dotripleargument", "doquadrupleargument", "doquintupleargument", "dosixtupleargument", "doseventupleargument", "dosinglegroupempty", "dodoublegroupempty", "dotriplegroupempty", "doquadruplegroupempty", "doquintuplegroupempty", "permitspacesbetweengroups", "dontpermitspacesbetweengroups", "nopdfcompression", "maximumpdfcompression", "normalpdfcompression", "onlypdfobjectcompression", "nopdfobjectcompression", "modulonumber", "dividenumber", "getfirstcharacter", "doifelsefirstchar", "doiffirstcharelse", "mathclassvalue", "startnointerference", "stopnointerference", "twodigits", "threedigits", "leftorright", "offinterlineskip", "oninterlineskip", "nointerlineskip", "strut", "halfstrut", "quarterstrut", "depthstrut", "halflinestrut", "noheightstrut", "setstrut", "strutbox", "strutht", "strutdp", "strutwd", "struthtdp", "strutgap", "begstrut", "endstrut", "lineheight", "leftboundary", "rightboundary", "signalcharacter", "aligncontentleft", "aligncontentmiddle", "aligncontentright", "shiftbox", "vpackbox", "hpackbox", "vpackedbox", "hpackedbox", "ordordspacing", "ordopspacing", "ordbinspacing", "ordrelspacing", "ordopenspacing", "ordclosespacing", "ordpunctspacing", "ordinnerspacing", "ordfracspacing", "ordradspacing", "ordmiddlespacing", "ordaccentspacing", "opordspacing", "opopspacing", "opbinspacing", "oprelspacing", "opopenspacing", "opclosespacing", "oppunctspacing", "opinnerspacing", "opfracspacing", "opradspacing", "opmiddlespacing", "opaccentspacing", "binordspacing", "binopspacing", "binbinspacing", "binrelspacing", "binopenspacing", "binclosespacing", "binpunctspacing", "bininnerspacing", "binfracspacing", "binradspacing", "binmiddlespacing", "binaccentspacing", "relordspacing", "relopspacing", "relbinspacing", "relrelspacing", "relopenspacing", "relclosespacing", "relpunctspacing", "relinnerspacing", "relfracspacing", "relradspacing", "relmiddlespacing", "relaccentspacing", "openordspacing", "openopspacing", "openbinspacing", "openrelspacing", "openopenspacing", "openclosespacing", "openpunctspacing", "openinnerspacing", "openfracspacing", "openradspacing", "openmiddlespacing", "openaccentspacing", "closeordspacing", "closeopspacing", "closebinspacing", "closerelspacing", "closeopenspacing", "closeclosespacing", "closepunctspacing", "closeinnerspacing", "closefracspacing", "closeradspacing", "closemiddlespacing", "closeaccentspacing", "punctordspacing", "punctopspacing", "punctbinspacing", "punctrelspacing", "punctopenspacing", "punctclosespacing", "punctpunctspacing", "punctinnerspacing", "punctfracspacing", "punctradspacing", "punctmiddlespacing", "punctaccentspacing", "innerordspacing", "inneropspacing", "innerbinspacing", "innerrelspacing", "inneropenspacing", "innerclosespacing", "innerpunctspacing", "innerinnerspacing", "innerfracspacing", "innerradspacing", "innermiddlespacing", "inneraccentspacing", "fracordspacing", "fracopspacing", "fracbinspacing", "fracrelspacing", "fracopenspacing", "fracclosespacing", "fracpunctspacing", "fracinnerspacing", "fracfracspacing", "fracradspacing", "fracmiddlespacing", "fracaccentspacing", "radordspacing", "radopspacing", "radbinspacing", "radrelspacing", "radopenspacing", "radclosespacing", "radpunctspacing", "radinnerspacing", "radfracspacing", "radradspacing", "radmiddlespacing", "radaccentspacing", "middleordspacing", "middleopspacing", "middlebinspacing", "middlerelspacing", "middleopenspacing", "middleclosespacing", "middlepunctspacing", "middleinnerspacing", "middlefracspacing", "middleradspacing", "middlemiddlespacing", "middleaccentspacing", "accentordspacing", "accentopspacing", "accentbinspacing", "accentrelspacing", "accentopenspacing", "accentclosespacing", "accentpunctspacing", "accentinnerspacing", "accentfracspacing", "accentradspacing", "accentmiddlespacing", "accentaccentspacing", "normalreqno", "startimath", "stopimath", "normalstartimath", "normalstopimath", "startdmath", "stopdmath", "normalstartdmath", "normalstopdmath", "normalsuperscript", "normalsubscript", "normalnosuperscript", "normalnosubscript", "normalprimescript", "superscript", "subscript", "nosuperscript", "nosubscript", "primescript", "superprescript", "subprescript", "nosuperprescript", "nosubsprecript", "uncramped", "cramped", "mathstyletrigger", "triggermathstyle", "triggeredmathstyle", "mathstylefont", "mathsmallstylefont", "mathstyleface", "mathsmallstyleface", "mathstylecommand", "mathpalette", "mathstylehbox", "mathstylevbox", "mathstylevcenter", "mathstylevcenteredhbox", "mathstylevcenteredvbox", "mathtext", "setmathsmalltextbox", "setmathtextbox", "pushmathstyle", "popmathstyle", "triggerdisplaystyle", "triggertextstyle", "triggerscriptstyle", "triggerscriptscriptstyle", "triggeruncrampedstyle", "triggercrampedstyle", "triggersmallstyle", "triggeruncrampedsmallstyle", "triggercrampedsmallstyle", "triggerbigstyle", "triggeruncrampedbigstyle", "triggercrampedbigstyle", "luaexpr", "expelsedoif", "expdoif", "expdoifnot", "expdoifelsecommon", "expdoifcommonelse", "expdoifelseinset", "expdoifinsetelse", "ctxdirectlua", "ctxlatelua", "ctxsprint", "ctxwrite", "ctxcommand", "ctxdirectcommand", "ctxlatecommand", "ctxreport", "ctxlua", "luacode", "lateluacode", "directluacode", "registerctxluafile", "ctxloadluafile", "luaversion", "luamajorversion", "luaminorversion", "ctxluacode", "luaconditional", "luaexpanded", "ctxluamatch", "startluaparameterset", "stopluaparameterset", "luaparameterset", "definenamedlua", "obeylualines", "obeyluatokens", "startluacode", "stopluacode", "startlua", "stoplua", "startctxfunction", "stopctxfunction", "ctxfunction", "startctxfunctiondefinition", "stopctxfunctiondefinition", "installctxfunction", "installprotectedctxfunction", "installprotectedctxscanner", "installctxscanner", "resetctxscanner", "cldprocessfile", "cldloadfile", "cldloadviafile", "cldcontext", "cldcommand", "carryoverpar", "freezeparagraphproperties", "defrostparagraphproperties", "setparagraphfreezing", "forgetparagraphfreezing", "updateparagraphproperties", "updateparagraphpenalties", "updateparagraphdemerits", "updateparagraphshapes", "updateparagraphlines", "lastlinewidth", "assumelongusagecs", "Umathbottomaccent", "Umathtopaccent", "Umathbotaccent", "righttolefthbox", "lefttorighthbox", "righttoleftvbox", "lefttorightvbox", "righttoleftvtop", "lefttorightvtop", "rtlhbox", "ltrhbox", "rtlvbox", "ltrvbox", "rtlvtop", "ltrvtop", "autodirhbox", "autodirvbox", "autodirvtop", "leftorrighthbox", "leftorrightvbox", "leftorrightvtop", "lefttoright", "righttoleft", "checkedlefttoright", "checkedrighttoleft", "synchronizelayoutdirection", "synchronizedisplaydirection", "synchronizeinlinedirection", "dirlre", "dirrle", "dirlro", "dirrlo", "rtltext", "ltrtext", "lesshyphens", "morehyphens", "nohyphens", "dohyphens", "dohyphencollapsing", "nohyphencollapsing", "compounddiscretionary", "Ucheckedstartdisplaymath", "Ucheckedstopdisplaymath", "break", "nobreak", "allowbreak", "goodbreak", "nospace", "nospacing", "dospacing", "naturalhbox", "naturalvbox", "naturalvtop", "naturalhpack", "naturalvpack", "naturaltpack", "reversehbox", "reversevbox", "reversevtop", "reversehpack", "reversevpack", "reversetpack", "hcontainer", "vcontainer", "tcontainer", "frule", "compoundhyphenpenalty", "start", "stop", "unsupportedcs", "openout", "closeout", "write", "openin", "closein", "read", "readline", "readfromterminal", "boxlines", "boxline", "setboxline", "copyboxline", "boxlinewd", "boxlineht", "boxlinedp", "boxlinenw", "boxlinenh", "boxlinend", "boxlinels", "boxliners", "boxlinelh", "boxlinerh", "boxlinelp", "boxlinerp", "boxlinein", "boxrangewd", "boxrangeht", "boxrangedp", "bitwiseset", "bitwiseand", "bitwiseor", "bitwisexor", "bitwisenot", "bitwisenil", "ifbitwiseand", "bitwise", "bitwiseshift", "bitwiseflip", "textdir", "linedir", "pardir", "boxdir", "prelistbox", "postlistbox", "prelistcopy", "postlistcopy", "setprelistbox", "setpostlistbox", "noligaturing", "nokerning", "noexpansion", "noprotrusion", "noleftkerning", "noleftligaturing", "norightkerning", "norightligaturing", "noitaliccorrection", "futureletnexttoken", "defbackslashbreak", "letbackslashbreak", "pushoverloadmode", "popoverloadmode", "pushrunstate", "poprunstate", "suggestedalias", "showboxhere", "discoptioncodestring", "flagcodestring", "frozenparcodestring", "glyphoptioncodestring", "groupcodestring", "hyphenationcodestring", "mathcontrolcodestring", "mathflattencodestring", "normalizecodestring", "parcontextcodestring", "newlocalcount", "newlocaldimen", "newlocalskip", "newlocalmuskip", "newlocaltoks", "newlocalbox", "newlocalwrite", "newlocalread", "setnewlocalcount", "setnewlocaldimen", "setnewlocalskip", "setnewlocalmuskip", "setnewlocaltoks", "setnewlocalbox", "ifexpression" }, }
\ No newline at end of file diff --git a/context/data/scite/context/lexers/data/scite-context-data-tex.lua b/context/data/scite/context/lexers/data/scite-context-data-tex.lua index f91d06f06..e9d97ef2c 100644 --- a/context/data/scite/context/lexers/data/scite-context-data-tex.lua +++ b/context/data/scite/context/lexers/data/scite-context-data-tex.lua @@ -1,7 +1,7 @@ return { ["aleph"]={ "Alephminorversion", "Alephrevision", "Alephversion" }, ["etex"]={ "botmarks", "clubpenalties", "currentgrouplevel", "currentgrouptype", "currentifbranch", "currentiflevel", "currentiftype", "detokenize", "dimexpr", "displaywidowpenalties", "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", "savinghyphcodes", "savingvdiscards", "scantokens", "showgroups", "showifs", "showtokens", "splitbotmarks", "splitdiscards", "splitfirstmarks", "topmarks", "tracingassigns", "tracinggroups", "tracingifs", "tracingnesting", "unexpanded", "unless", "widowpenalties" }, - ["luatex"]={ "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelimited", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaccentbasedepth", "Umathaccentbaseheight", "Umathaccentbottomovershoot", "Umathaccentbottomshiftdown", "Umathaccentextendmargin", "Umathaccentsuperscriptdrop", "Umathaccentsuperscriptpercent", "Umathaccenttopovershoot", "Umathaccenttopshiftup", "Umathaccentvariant", "Umathadapttoleft", "Umathadapttoright", "Umathaxis", "Umathbottomaccentvariant", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharslot", "Umathclass", "Umathcode", "Umathconnectoroverlapmin", "Umathdegreevariant", "Umathdelimiterovervariant", "Umathdelimiterpercent", "Umathdelimitershortfall", "Umathdelimiterundervariant", "Umathdenominatorvariant", "Umathdict", "Umathdictdef", "Umathdiscretionary", "Umathextrasubpreshift", "Umathextrasubprespace", "Umathextrasubshift", "Umathextrasubspace", "Umathextrasuppreshift", "Umathextrasupprespace", "Umathextrasupshift", "Umathextrasupspace", "Umathflattenedaccentbasedepth", "Umathflattenedaccentbaseheight", "Umathflattenedaccentbottomshiftdown", "Umathflattenedaccenttopshiftup", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathfractionvariant", "Umathhextensiblevariant", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathlimits", "Umathnoaxis", "Umathnolimits", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathnumeratorvariant", "Umathopenupdepth", "Umathopenupheight", "Umathoperatorsize", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervariant", "Umathoverdelimitervgap", "Umathoverlayaccentvariant", "Umathoverlinevariant", "Umathphantom", "Umathpresubshiftdistance", "Umathpresupshiftdistance", "Umathprimeraise", "Umathprimeraisecomposed", "Umathprimeshiftdrop", "Umathprimeshiftup", "Umathprimespaceafter", "Umathprimevariant", "Umathprimewidth", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalextensibleafter", "Umathradicalextensiblebefore", "Umathradicalkern", "Umathradicalrule", "Umathradicalvariant", "Umathradicalvgap", "Umathruledepth", "Umathruleheight", "Umathskeweddelimitertolerance", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathsource", "Umathspaceafterscript", "Umathspacebeforescript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvariant", "Umathstackvgap", "Umathsubscriptvariant", "Umathsubshiftdistance", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsuperscriptvariant", "Umathsupshiftdistance", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathtopaccentvariant", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervariant", "Umathunderdelimitervgap", "Umathunderlinevariant", "Umathuseaxis", "Umathvextensiblevariant", "Umathvoid", "Umathxscale", "Umathyscale", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uoperator", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uprimescript", "Uradical", "Uright", "Uroot", "Urooted", "Ushiftedsubprescript", "Ushiftedsubscript", "Ushiftedsuperprescript", "Ushiftedsuperscript", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustartmathmode", "Ustopdisplaymath", "Ustopmath", "Ustopmathmode", "Ustretched", "Ustretchedwithdelims", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "aligncontent", "alignmark", "alignmentcellsource", "alignmentwrapsource", "aligntab", "allcrampedstyles", "alldisplaystyles", "allmainstyles", "allmathstyles", "allscriptscriptstyles", "allscriptstyles", "allsplitstyles", "alltextstyles", "alluncrampedstyles", "allunsplitstyles", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "autoparagraphmode", "begincsname", "beginlocalcontrol", "beginmathgroup", "beginsimplegroup", "boundary", "boxadapt", "boxanchor", "boxanchors", "boxattribute", "boxdirection", "boxfreeze", "boxgeometry", "boxorientation", "boxrepack", "boxshift", "boxsource", "boxtarget", "boxtotal", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "clearmarks", "copymathatomrule", "copymathparent", "copymathspacing", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csstring", "currentloopiterator", "currentloopnesting", "currentmarks", "defcsname", "detokenized", "dimensiondef", "dimexpression", "directlua", "edefcsname", "efcode", "endlocalcontrol", "endmathgroup", "endsimplegroup", "enforced", "etoks", "etoksapp", "etokspre", "everybeforepar", "everymathatom", "everytab", "exceptionpenalty", "expand", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandedafter", "expandedloop", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "flushmarks", "fontcharta", "fontid", "fontmathcontrol", "fontspecdef", "fontspecid", "fontspecifiedname", "fontspecifiedsize", "fontspecscale", "fontspecxscale", "fontspecyscale", "fonttextcontrol", "formatname", "frozen", "futurecsname", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gdefcsname", "gleaders", "glet", "gletcsname", "glettonothing", "gluespecdef", "glyph", "glyphdatafield", "glyphoptions", "glyphscale", "glyphscriptfield", "glyphscriptscale", "glyphscriptscriptscale", "glyphstatefield", "glyphtextscale", "glyphxoffset", "glyphxscale", "glyphxscaled", "glyphyoffset", "glyphyscale", "glyphyscaled", "gtoksapp", "gtokspre", "hccode", "hjcode", "hmcode", "holdingmigrations", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchknum", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimexpression", "ifdimval", "ifempty", "ifflags", "ifhaschar", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifinsert", "ifmathparameter", "ifmathstyle", "ifnumexpression", "ifnumval", "ifparameter", "ifparameters", "ifrelax", "iftok", "ifzerodim", "ifzeronum", "ignorearguments", "ignorepars", "immediate", "immutable", "indexofcharacter", "indexofregister", "inherited", "initcatcodetable", "insertbox", "insertcopy", "insertdepth", "insertdistance", "insertheight", "insertheights", "insertlimit", "insertmaxdepth", "insertmode", "insertmultiplier", "insertpenalty", "insertprogress", "insertstorage", "insertstoring", "insertunbox", "insertuncopy", "insertwidth", "instance", "integerdef", "lastarguments", "lastatomclass", "lastboundary", "lastchkdim", "lastchknum", "lastleftclass", "lastloopiterator", "lastnamedcs", "lastnodesubtype", "lastpageextra", "lastparcontext", "lastrightclass", "leftmarginkern", "letcharcode", "letcsname", "letfrozen", "letmathatomrule", "letmathparent", "letmathspacing", "letprotected", "lettonothing", "linebreakcriterium", "linedirection", "localbrokenpenalty", "localcontrol", "localcontrolled", "localcontrolledloop", "localinterlinepenalty", "localleftbox", "localleftboxbox", "localmiddlebox", "localmiddleboxbox", "localrightbox", "localrightboxbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathaccent", "mathatom", "mathatomglue", "mathatomskip", "mathbackwardpenalties", "mathbeginclass", "mathcheckfencesmode", "mathdictgroup", "mathdictproperties", "mathdirection", "mathdisplaymode", "mathdisplayskipmode", "mathdoublescriptmode", "mathendclass", "matheqnogapstep", "mathfenced", "mathfontcontrol", "mathforwardpenalties", "mathfrac", "mathghost", "mathgluemode", "mathgroupingmode", "mathleftclass", "mathlimitsmode", "mathmainstyle", "mathmiddle", "mathnolimitsmode", "mathpenaltiesmode", "mathrad", "mathrightclass", "mathrulesfam", "mathrulesmode", "mathscale", "mathscriptsmode", "mathslackmode", "mathspacingmode", "mathstackstyle", "mathstyle", "mathstylefontid", "mathsurroundmode", "mathsurroundskip", "maththreshold", "meaningasis", "meaningfull", "meaningless", "mugluespecdef", "mutable", "noaligned", "noatomruling", "noboundary", "nohrule", "norelax", "normalizelinemode", "normalizeparmode", "nospaces", "novrule", "numericscale", "numexpression", "orelse", "orphanpenalties", "orphanpenalty", "orunless", "outputbox", "overloaded", "overloadmode", "overshoot", "pageboundary", "pageextragoal", "pagevsize", "parametercount", "parametermark", "parattribute", "pardirection", "permanent", "pettymuskip", "postexhyphenchar", "posthyphenchar", "postinlinepenalty", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "preinlinepenalty", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitloop", "quitvmode", "resetmathspacing", "retokenized", "rightmarginkern", "rpcode", "savecatcodetable", "scaledemwidth", "scaledexheight", "scaledextraspace", "scaledfontdimen", "scaledinterwordshrink", "scaledinterwordspace", "scaledinterwordstretch", "scaledmathstyle", "scaledslantperpoint", "scantextokens", "semiexpand", "semiexpanded", "semiprotected", "setdefaultmathcodes", "setfontid", "setmathatomrule", "setmathdisplaypostpenalty", "setmathdisplayprepenalty", "setmathignore", "setmathoptions", "setmathpostpenalty", "setmathprepenalty", "setmathspacing", "shapingpenaltiesmode", "shapingpenalty", "snapshotpar", "srule", "supmarkmode", "swapcsvalues", "tabsize", "textdirection", "thewithoutunit", "tinymuskip", "todimension", "tohexadecimal", "tointeger", "tokenized", "toksapp", "tokspre", "tolerant", "tomathstyle", "toscaled", "tosparsedimension", "tosparsescaled", "tpack", "tracingadjusts", "tracingalignments", "tracingexpressions", "tracingfonts", "tracingfullboxes", "tracinghyphenation", "tracinginserts", "tracinglevels", "tracingmarks", "tracingmath", "tracingnodes", "tracingpenalties", "uleaders", "undent", "unexpandedloop", "unhpack", "unletfrozen", "unletprotected", "untraced", "unvpack", "vpack", "wordboundary", "wrapuppar", "xdefcsname", "xtoks", "xtoksapp", "xtokspre" }, + ["luatex"]={ "Uabove", "Uabovewithdelims", "Uatop", "Uatopwithdelims", "Uchar", "Udelcode", "Udelimited", "Udelimiter", "Udelimiterover", "Udelimiterunder", "Uhextensible", "Uleft", "Umathaccent", "Umathaccentbasedepth", "Umathaccentbaseheight", "Umathaccentbottomovershoot", "Umathaccentbottomshiftdown", "Umathaccentextendmargin", "Umathaccentsuperscriptdrop", "Umathaccentsuperscriptpercent", "Umathaccenttopovershoot", "Umathaccenttopshiftup", "Umathaccentvariant", "Umathadapttoleft", "Umathadapttoright", "Umathaxis", "Umathbottomaccentvariant", "Umathchar", "Umathcharclass", "Umathchardef", "Umathcharfam", "Umathcharslot", "Umathclass", "Umathcode", "Umathconnectoroverlapmin", "Umathdegreevariant", "Umathdelimiterovervariant", "Umathdelimiterpercent", "Umathdelimitershortfall", "Umathdelimiterundervariant", "Umathdenominatorvariant", "Umathdict", "Umathdictdef", "Umathdiscretionary", "Umathextrasubpreshift", "Umathextrasubprespace", "Umathextrasubshift", "Umathextrasubspace", "Umathextrasuppreshift", "Umathextrasupprespace", "Umathextrasupshift", "Umathextrasupspace", "Umathflattenedaccentbasedepth", "Umathflattenedaccentbaseheight", "Umathflattenedaccentbottomshiftdown", "Umathflattenedaccenttopshiftup", "Umathfractiondelsize", "Umathfractiondenomdown", "Umathfractiondenomvgap", "Umathfractionnumup", "Umathfractionnumvgap", "Umathfractionrule", "Umathfractionvariant", "Umathhextensiblevariant", "Umathlimitabovebgap", "Umathlimitabovekern", "Umathlimitabovevgap", "Umathlimitbelowbgap", "Umathlimitbelowkern", "Umathlimitbelowvgap", "Umathlimits", "Umathnoaxis", "Umathnolimits", "Umathnolimitsubfactor", "Umathnolimitsupfactor", "Umathnumeratorvariant", "Umathopenupdepth", "Umathopenupheight", "Umathoperatorsize", "Umathoverbarkern", "Umathoverbarrule", "Umathoverbarvgap", "Umathoverdelimiterbgap", "Umathoverdelimitervariant", "Umathoverdelimitervgap", "Umathoverlayaccentvariant", "Umathoverlinevariant", "Umathphantom", "Umathpresubshiftdistance", "Umathpresupshiftdistance", "Umathprimeraise", "Umathprimeraisecomposed", "Umathprimeshiftdrop", "Umathprimeshiftup", "Umathprimespaceafter", "Umathprimevariant", "Umathprimewidth", "Umathquad", "Umathradicaldegreeafter", "Umathradicaldegreebefore", "Umathradicaldegreeraise", "Umathradicalextensibleafter", "Umathradicalextensiblebefore", "Umathradicalkern", "Umathradicalrule", "Umathradicalvariant", "Umathradicalvgap", "Umathruledepth", "Umathruleheight", "Umathskeweddelimitertolerance", "Umathskewedfractionhgap", "Umathskewedfractionvgap", "Umathsource", "Umathspaceafterscript", "Umathspacebeforescript", "Umathstackdenomdown", "Umathstacknumup", "Umathstackvariant", "Umathstackvgap", "Umathsubscriptvariant", "Umathsubshiftdistance", "Umathsubshiftdown", "Umathsubshiftdrop", "Umathsubsupshiftdown", "Umathsubsupvgap", "Umathsubtopmax", "Umathsupbottommin", "Umathsuperscriptvariant", "Umathsupshiftdistance", "Umathsupshiftdrop", "Umathsupshiftup", "Umathsupsubbottommax", "Umathtopaccentvariant", "Umathunderbarkern", "Umathunderbarrule", "Umathunderbarvgap", "Umathunderdelimiterbgap", "Umathunderdelimitervariant", "Umathunderdelimitervgap", "Umathunderlinevariant", "Umathuseaxis", "Umathvextensiblevariant", "Umathvoid", "Umathxscale", "Umathyscale", "Umiddle", "Unosubprescript", "Unosubscript", "Unosuperprescript", "Unosuperscript", "Uoperator", "Uover", "Uoverdelimiter", "Uoverwithdelims", "Uprimescript", "Uradical", "Uright", "Uroot", "Urooted", "Ushiftedsubprescript", "Ushiftedsubscript", "Ushiftedsuperprescript", "Ushiftedsuperscript", "Uskewed", "Uskewedwithdelims", "Ustack", "Ustartdisplaymath", "Ustartmath", "Ustartmathmode", "Ustopdisplaymath", "Ustopmath", "Ustopmathmode", "Ustretched", "Ustretchedwithdelims", "Ustyle", "Usubprescript", "Usubscript", "Usuperprescript", "Usuperscript", "Uunderdelimiter", "Uvextensible", "adjustspacing", "adjustspacingshrink", "adjustspacingstep", "adjustspacingstretch", "afterassigned", "aftergrouped", "aliased", "aligncontent", "alignmark", "alignmentcellsource", "alignmentwrapsource", "aligntab", "allcrampedstyles", "alldisplaystyles", "allmainstyles", "allmathstyles", "allscriptscriptstyles", "allscriptstyles", "allsplitstyles", "alltextstyles", "alluncrampedstyles", "allunsplitstyles", "atendofgroup", "atendofgrouped", "attribute", "attributedef", "automaticdiscretionary", "automatichyphenpenalty", "automigrationmode", "autoparagraphmode", "begincsname", "beginlocalcontrol", "beginmathgroup", "beginsimplegroup", "boundary", "boxadapt", "boxanchor", "boxanchors", "boxattribute", "boxdirection", "boxfreeze", "boxgeometry", "boxorientation", "boxrepack", "boxshift", "boxsource", "boxtarget", "boxtotal", "boxxmove", "boxxoffset", "boxymove", "boxyoffset", "catcodetable", "clearmarks", "copymathatomrule", "copymathparent", "copymathspacing", "crampeddisplaystyle", "crampedscriptscriptstyle", "crampedscriptstyle", "crampedtextstyle", "csstring", "currentloopiterator", "currentloopnesting", "currentmarks", "defcsname", "detokenized", "dimensiondef", "dimexpression", "directlua", "edefcsname", "efcode", "endlocalcontrol", "endmathgroup", "endsimplegroup", "enforced", "etoks", "etoksapp", "etokspre", "everybeforepar", "everymathatom", "everytab", "exceptionpenalty", "expand", "expandafterpars", "expandafterspaces", "expandcstoken", "expanded", "expandedafter", "expandedloop", "expandtoken", "explicitdiscretionary", "explicithyphenpenalty", "firstvalidlanguage", "flushmarks", "fontcharta", "fontid", "fontmathcontrol", "fontspecdef", "fontspecid", "fontspecifiedname", "fontspecifiedsize", "fontspecscale", "fontspecxscale", "fontspecyscale", "fonttextcontrol", "formatname", "frozen", "futurecsname", "futuredef", "futureexpand", "futureexpandis", "futureexpandisap", "gdefcsname", "gleaders", "glet", "gletcsname", "glettonothing", "gluespecdef", "glyph", "glyphdatafield", "glyphoptions", "glyphscale", "glyphscriptfield", "glyphscriptscale", "glyphscriptscriptscale", "glyphstatefield", "glyphtextscale", "glyphxoffset", "glyphxscale", "glyphxscaled", "glyphyoffset", "glyphyscale", "glyphyscaled", "gtoksapp", "gtokspre", "hccode", "hjcode", "hmcode", "holdingmigrations", "hpack", "hyphenationmin", "hyphenationmode", "ifabsdim", "ifabsnum", "ifarguments", "ifboolean", "ifchkdim", "ifchknum", "ifcmpdim", "ifcmpnum", "ifcondition", "ifcstok", "ifdimexpression", "ifdimval", "ifempty", "ifflags", "ifhaschar", "ifhastok", "ifhastoks", "ifhasxtoks", "ifincsname", "ifinsert", "ifmathparameter", "ifmathstyle", "ifnumexpression", "ifnumval", "ifparameter", "ifparameters", "ifrelax", "iftok", "ifzerodim", "ifzeronum", "ignorearguments", "ignorepars", "immediate", "immutable", "indexofcharacter", "indexofregister", "inherited", "initcatcodetable", "insertbox", "insertcopy", "insertdepth", "insertdistance", "insertheight", "insertheights", "insertlimit", "insertmaxdepth", "insertmode", "insertmultiplier", "insertpenalty", "insertprogress", "insertstorage", "insertstoring", "insertunbox", "insertuncopy", "insertwidth", "instance", "integerdef", "lastarguments", "lastatomclass", "lastboundary", "lastchkdim", "lastchknum", "lastleftclass", "lastloopiterator", "lastnamedcs", "lastnodesubtype", "lastpageextra", "lastparcontext", "lastrightclass", "leftmarginkern", "letcharcode", "letcsname", "letfrozen", "letmathatomrule", "letmathparent", "letmathspacing", "letprotected", "lettonothing", "linebreakcriterium", "linedirection", "localbrokenpenalty", "localcontrol", "localcontrolled", "localcontrolledloop", "localinterlinepenalty", "localleftbox", "localleftboxbox", "localmiddlebox", "localmiddleboxbox", "localrightbox", "localrightboxbox", "lpcode", "luabytecode", "luabytecodecall", "luacopyinputnodes", "luadef", "luaescapestring", "luafunction", "luafunctioncall", "luatexbanner", "luatexrevision", "luatexversion", "mathaccent", "mathatom", "mathatomglue", "mathatomskip", "mathbackwardpenalties", "mathbeginclass", "mathcheckfencesmode", "mathdictgroup", "mathdictproperties", "mathdirection", "mathdisplaymode", "mathdisplayskipmode", "mathdoublescriptmode", "mathendclass", "matheqnogapstep", "mathfenced", "mathfontcontrol", "mathforwardpenalties", "mathfrac", "mathghost", "mathgluemode", "mathgroupingmode", "mathleftclass", "mathlimitsmode", "mathmainstyle", "mathmiddle", "mathnolimitsmode", "mathpenaltiesmode", "mathrad", "mathrightclass", "mathrulesfam", "mathrulesmode", "mathscale", "mathscriptsmode", "mathslackmode", "mathspacingmode", "mathstackstyle", "mathstyle", "mathstylefontid", "mathsurroundmode", "mathsurroundskip", "maththreshold", "meaningasis", "meaningfull", "meaningless", "mugluespecdef", "mutable", "noaligned", "noatomruling", "noboundary", "nohrule", "norelax", "normalizelinemode", "normalizeparmode", "nospaces", "novrule", "numericscale", "numexpression", "orelse", "orphanpenalties", "orphanpenalty", "orunless", "outputbox", "overloaded", "overloadmode", "overshoot", "pageboundary", "pageextragoal", "pagevsize", "parametercount", "parametermark", "parattribute", "pardirection", "permanent", "pettymuskip", "postexhyphenchar", "posthyphenchar", "postinlinepenalty", "prebinoppenalty", "predisplaygapfactor", "preexhyphenchar", "prehyphenchar", "preinlinepenalty", "prerelpenalty", "protrudechars", "protrusionboundary", "pxdimen", "quitloop", "quitvmode", "resetmathspacing", "retokenized", "rightmarginkern", "rpcode", "savecatcodetable", "scaledemwidth", "scaledexheight", "scaledextraspace", "scaledfontdimen", "scaledinterwordshrink", "scaledinterwordspace", "scaledinterwordstretch", "scaledmathstyle", "scaledslantperpoint", "scantextokens", "semiexpand", "semiexpanded", "semiprotected", "setdefaultmathcodes", "setfontid", "setmathatomrule", "setmathdisplaypostpenalty", "setmathdisplayprepenalty", "setmathignore", "setmathoptions", "setmathpostpenalty", "setmathprepenalty", "setmathspacing", "shapingpenaltiesmode", "shapingpenalty", "snapshotpar", "srule", "supmarkmode", "swapcsvalues", "tabsize", "textdirection", "thewithoutunit", "tinymuskip", "todimension", "tohexadecimal", "tointeger", "tokenized", "toksapp", "tokspre", "tolerant", "tomathstyle", "toscaled", "tosparsedimension", "tosparsescaled", "tpack", "tracingadjusts", "tracingalignments", "tracingexpressions", "tracingfonts", "tracingfullboxes", "tracinghyphenation", "tracinginserts", "tracinglevels", "tracingmarks", "tracingmath", "tracingnodes", "tracingpenalties", "uleaders", "undent", "unexpandedloop", "unhpack", "unletfrozen", "unletprotected", "untraced", "unvpack", "variablefam", "vpack", "wordboundary", "wrapuppar", "xdefcsname", "xtoks", "xtoksapp", "xtokspre" }, ["omega"]={ "Omegaminorversion", "Omegarevision", "Omegaversion" }, ["pdftex"]={ "ifpdfabsdim", "ifpdfabsnum", "ifpdfprimitive", "pdfadjustspacing", "pdfannot", "pdfcatalog", "pdfcolorstack", "pdfcolorstackinit", "pdfcompresslevel", "pdfcopyfont", "pdfcreationdate", "pdfdecimaldigits", "pdfdest", "pdfdestmargin", "pdfdraftmode", "pdfeachlinedepth", "pdfeachlineheight", "pdfendlink", "pdfendthread", "pdffirstlineheight", "pdffontattr", "pdffontexpand", "pdffontname", "pdffontobjnum", "pdffontsize", "pdfgamma", "pdfgentounicode", "pdfglyphtounicode", "pdfhorigin", "pdfignoreddimen", "pdfignoreunknownimages", "pdfimageaddfilename", "pdfimageapplygamma", "pdfimagegamma", "pdfimagehicolor", "pdfimageresolution", "pdfincludechars", "pdfinclusioncopyfonts", "pdfinclusionerrorlevel", "pdfinfo", "pdfinfoomitdate", "pdfinsertht", "pdflastannot", "pdflastlinedepth", "pdflastlink", "pdflastobj", "pdflastxform", "pdflastximage", "pdflastximagepages", "pdflastxpos", "pdflastypos", "pdflinkmargin", "pdfliteral", "pdfmajorversion", "pdfmapfile", "pdfmapline", "pdfminorversion", "pdfnames", "pdfnoligatures", "pdfnormaldeviate", "pdfobj", "pdfobjcompresslevel", "pdfomitcharset", "pdfomitcidset", "pdfomitinfodict", "pdfoutline", "pdfoutput", "pdfpageattr", "pdfpagebox", "pdfpageheight", "pdfpageref", "pdfpageresources", "pdfpagesattr", "pdfpagewidth", "pdfpkfixeddpi", "pdfpkmode", "pdfpkresolution", "pdfprimitive", "pdfprotrudechars", "pdfpxdimen", "pdfrandomseed", "pdfrecompress", "pdfrefobj", "pdfrefxform", "pdfrefximage", "pdfreplacefont", "pdfrestore", "pdfretval", "pdfsave", "pdfsavepos", "pdfsetmatrix", "pdfsetrandomseed", "pdfstartlink", "pdfstartthread", "pdfsuppressoptionalinfo", "pdfsuppressptexinfo", "pdftexbanner", "pdftexrevision", "pdftexversion", "pdfthread", "pdfthreadmargin", "pdftracingfonts", "pdftrailer", "pdftrailerid", "pdfuniformdeviate", "pdfuniqueresname", "pdfvorigin", "pdfxform", "pdfxformattr", "pdfxformmargin", "pdfxformname", "pdfxformresources", "pdfximage" }, ["tex"]={ " ", "-", "/", "above", "abovedisplayshortskip", "abovedisplayskip", "abovewithdelims", "accent", "adjdemerits", "advance", "afterassignment", "aftergroup", "atop", "atopwithdelims", "badness", "baselineskip", "batchmode", "begingroup", "belowdisplayshortskip", "belowdisplayskip", "binoppenalty", "botmark", "box", "boxmaxdepth", "brokenpenalty", "catcode", "char", "chardef", "cleaders", "clubpenalty", "copy", "count", "countdef", "cr", "crcr", "csname", "day", "deadcycles", "def", "defaulthyphenchar", "defaultskewchar", "delcode", "delimiter", "delimiterfactor", "delimitershortfall", "dimen", "dimendef", "discretionary", "displayindent", "displaylimits", "displaystyle", "displaywidowpenalty", "displaywidth", "divide", "doublehyphendemerits", "dp", "dump", "edef", "else", "emergencystretch", "end", "endcsname", "endgroup", "endinput", "endlinechar", "eqno", "errhelp", "errmessage", "errorcontextlines", "errorstopmode", "escapechar", "everycr", "everydisplay", "everyhbox", "everyjob", "everymath", "everypar", "everyvbox", "exhyphenchar", "exhyphenpenalty", "expandafter", "fam", "fi", "finalhyphendemerits", "firstmark", "floatingpenalty", "font", "fontdimen", "fontname", "futurelet", "gdef", "global", "globaldefs", "halign", "hangafter", "hangindent", "hbadness", "hbox", "hfil", "hfill", "hfilneg", "hfuzz", "holdinginserts", "hrule", "hsize", "hskip", "hss", "ht", "hyphenation", "hyphenchar", "hyphenpenalty", "if", "ifcase", "ifcat", "ifdim", "iffalse", "ifhbox", "ifhmode", "ifinner", "ifmmode", "ifnum", "ifodd", "iftrue", "ifvbox", "ifvmode", "ifvoid", "ifx", "ignorespaces", "indent", "input", "inputlineno", "insert", "insertpenalties", "interlinepenalty", "jobname", "kern", "language", "lastbox", "lastkern", "lastpenalty", "lastskip", "lccode", "leaders", "left", "lefthyphenmin", "leftskip", "leqno", "let", "limits", "linepenalty", "lineskip", "lineskiplimit", "long", "looseness", "lower", "lowercase", "mark", "mathbin", "mathchar", "mathchardef", "mathchoice", "mathclose", "mathcode", "mathinner", "mathop", "mathopen", "mathord", "mathpunct", "mathrel", "mathsurround", "maxdeadcycles", "maxdepth", "meaning", "medmuskip", "message", "middle", "mkern", "month", "moveleft", "moveright", "mskip", "multiply", "muskip", "muskipdef", "newlinechar", "noalign", "noexpand", "noindent", "nolimits", "nonscript", "nonstopmode", "nulldelimiterspace", "nullfont", "number", "omit", "or", "outer", "output", "outputpenalty", "over", "overfullrule", "overline", "overwithdelims", "pagedepth", "pagefilllstretch", "pagefillstretch", "pagefilstretch", "pagegoal", "pageshrink", "pagestretch", "pagetotal", "par", "parfillleftskip", "parfillskip", "parindent", "parinitleftskip", "parinitrightskip", "parshape", "parskip", "patterns", "pausing", "penalty", "postdisplaypenalty", "predisplaypenalty", "predisplaysize", "pretolerance", "prevdepth", "prevgraf", "radical", "raise", "relax", "relpenalty", "right", "righthyphenmin", "rightskip", "romannumeral", "scriptfont", "scriptscriptfont", "scriptscriptstyle", "scriptspace", "scriptstyle", "scrollmode", "setbox", "setlanguage", "sfcode", "shipout", "show", "showbox", "showboxbreadth", "showboxdepth", "showlists", "shownodedetails", "showthe", "skewchar", "skip", "skipdef", "spacefactor", "spaceskip", "span", "splitbotmark", "splitfirstmark", "splitmaxdepth", "splittopskip", "string", "tabskip", "textfont", "textstyle", "the", "thickmuskip", "thinmuskip", "time", "toks", "toksdef", "tolerance", "topmark", "topskip", "tracingcommands", "tracinglostchars", "tracingmacros", "tracingonline", "tracingoutput", "tracingpages", "tracingparagraphs", "tracingrestores", "tracingstats", "uccode", "uchyph", "unboundary", "underline", "unhbox", "unhcopy", "unkern", "unpenalty", "unskip", "unvbox", "unvcopy", "uppercase", "vadjust", "valign", "vbadness", "vbox", "vcenter", "vfil", "vfill", "vfilneg", "vfuzz", "vrule", "vsize", "vskip", "vsplit", "vss", "vtop", "wd", "widowpenalty", "xdef", "xleaders", "xspaceskip", "year" }, diff --git a/context/data/scite/context/scite-context-data-context.properties b/context/data/scite/context/scite-context-data-context.properties index ca2911ace..b45086658 100644 --- a/context/data/scite/context/scite-context-data-context.properties +++ b/context/data/scite/context/scite-context-data-context.properties @@ -52,73 +52,73 @@ overrulemathcontrolcode underrulemathcontrolcode radicalrulemathcontrolcode frac accentskewapplymathcontrolcode applyordinarykernpairmathcontrolcode applyverticalitalickernmathcontrolcode applyordinaryitalickernmathcontrolcode applycharitalickernmathcontrolcode \ reboxcharitalickernmathcontrolcode applyboxeditalickernmathcontrolcode staircasekernmathcontrolcode applytextitalickernmathcontrolcode applyscriptitalickernmathcontrolcode \ checkspaceitalickernmathcontrolcode checktextitalickernmathcontrolcode analyzescriptnucleuscharmathcontrolcode analyzescriptnucleuslistmathcontrolcode analyzescriptnucleusboxmathcontrolcode \ -accenttopskewwithoffsetmathcontrolcode ignorekerndimensionsmathcontrolcode noligaturingglyphoptioncode nokerningglyphoptioncode noexpansionglyphoptioncode \ -noprotrusionglyphoptioncode noleftkerningglyphoptioncode noleftligaturingglyphoptioncode norightkerningglyphoptioncode norightligaturingglyphoptioncode \ -noitaliccorrectionglyphoptioncode islargeoperatorglyphoptioncode hasitalicshapeglyphoptioncode normalparcontextcode vmodeparcontextcode \ -vboxparcontextcode vtopparcontextcode vcenterparcontextcode vadjustparcontextcode insertparcontextcode \ -outputparcontextcode alignparcontextcode noalignparcontextcode spanparcontextcode resetparcontextcode \ -leftoriginlistanchorcode leftheightlistanchorcode leftdepthlistanchorcode rightoriginlistanchorcode rightheightlistanchorcode \ -rightdepthlistanchorcode centeroriginlistanchorcode centerheightlistanchorcode centerdepthlistanchorcode halfwaytotallistanchorcode \ -halfwayheightlistanchorcode halfwaydepthlistanchorcode halfwayleftlistanchorcode halfwayrightlistanchorcode negatexlistsigncode \ -negateylistsigncode negatelistsigncode fontslantperpoint fontinterwordspace fontinterwordstretch \ -fontinterwordshrink fontexheight fontemwidth fontextraspace slantperpoint \ -mathexheight mathemwidth interwordspace interwordstretch interwordshrink \ -exheight emwidth extraspace mathaxisheight muquad \ -startmode stopmode startnotmode stopnotmode startmodeset \ -stopmodeset doifmode doifelsemode doifmodeelse doifnotmode \ -startmodeset stopmodeset startallmodes stopallmodes startnotallmodes \ -stopnotallmodes doifallmodes doifelseallmodes doifallmodeselse doifnotallmodes \ -startenvironment stopenvironment environment startcomponent stopcomponent \ -component startproduct stopproduct product startproject \ -stopproject project starttext stoptext startnotext \ -stopnotext startdocument stopdocument documentvariable unexpandeddocumentvariable \ -setupdocument presetdocument doifelsedocumentvariable doifdocumentvariableelse doifdocumentvariable \ -doifnotdocumentvariable startmodule stopmodule usemodule usetexmodule \ -useluamodule setupmodule currentmoduleparameter moduleparameter everystarttext \ -everystoptext startTEXpage stopTEXpage enablemode disablemode \ -preventmode definemode globalenablemode globaldisablemode globalpreventmode \ -pushmode popmode typescriptone typescripttwo typescriptthree \ -mathsizesuffix mathordinarycode mathordcode mathoperatorcode mathopcode \ -mathbinarycode mathbincode mathrelationcode mathrelcode mathopencode \ -mathclosecode mathpunctuationcode mathpunctcode mathovercode mathundercode \ -mathinnercode mathradicalcode mathfractioncode mathmiddlecode mathaccentcode \ -mathfencedcode mathghostcode mathvariablecode mathactivecode mathvcentercode \ -mathconstructcode mathwrappedcode mathbegincode mathendcode mathexplicitcode \ -mathdivisioncode mathfactorialcode mathdimensioncode mathexperimentalcode mathtextpunctuationcode \ -mathimaginarycode mathdifferentialcode mathexponentialcode mathellipsiscode mathfunctioncode \ -mathdigitcode mathalphacode mathboxcode mathchoicecode mathnothingcode \ -mathlimopcode mathnolopcode mathunsetcode mathunspacedcode mathallcode \ -mathfakecode mathunarycode mathmaybeordinarycode mathmayberelationcode mathmaybebinarycode \ -mathnumbergroupcode constantnumber constantnumberargument constantdimen constantdimenargument \ -constantemptyargument luastringsep !!bs !!es lefttorightmark \ -righttoleftmark lrm rlm bidilre bidirle \ -bidipop bidilro bidirlo breakablethinspace nobreakspace \ -nonbreakablespace narrownobreakspace zerowidthnobreakspace ideographicspace ideographichalffillspace \ -twoperemspace threeperemspace fourperemspace fiveperemspace sixperemspace \ -figurespace punctuationspace hairspace enquad emquad \ -zerowidthspace zerowidthnonjoiner zerowidthjoiner zwnj zwj \ -optionalspace asciispacechar softhyphen Ux eUx \ -Umathaccents parfillleftskip parfillrightskip startlmtxmode stoplmtxmode \ -startmkivmode stopmkivmode wildcardsymbol normalhyphenationcode automatichyphenationcode \ -explicithyphenationcode syllablehyphenationcode uppercasehyphenationcode collapsehyphenationcode compoundhyphenationcode \ -strictstarthyphenationcode strictendhyphenationcode automaticpenaltyhyphenationcode explicitpenaltyhyphenationcode permitgluehyphenationcode \ -permitallhyphenationcode permitmathreplacehyphenationcode forcecheckhyphenationcode lazyligatureshyphenationcode forcehandlerhyphenationcode \ -feedbackcompoundhyphenationcode ignoreboundshyphenationcode partialhyphenationcode completehyphenationcode normalizelinenormalizecode \ -parindentskipnormalizecode swaphangindentnormalizecode swapparsshapenormalizecode breakafterdirnormalizecode removemarginkernsnormalizecode \ -clipwidthnormalizecode flattendiscretionariesnormalizecode discardzerotabskipsnormalizecode flattenhleadersnormalizecode normalizeparnormalizeparcode \ -flattenvleadersnormalizeparcode nopreslackclassoptioncode nopostslackclassoptioncode lefttopkernclassoptioncode righttopkernclassoptioncode \ -leftbottomkernclassoptioncode rightbottomkernclassoptioncode lookaheadforendclassoptioncode noitaliccorrectionclassoptioncode defaultmathclassoptions \ -checkligatureclassoptioncode checkitaliccorrectionclassoptioncode checkkernpairclassoptioncode flattenclassoptioncode omitpenaltyclassoptioncode \ -unpackclassoptioncode raiseprimeclassoptioncode carryoverlefttopkernclassoptioncode carryoverleftbottomkernclassoptioncode carryoverrighttopkernclassoptioncode \ -carryoverrightbottomkernclassoptioncode preferdelimiterdimensionsclassoptioncode autoinjectclassoptioncode removeitaliccorrectionclassoptioncode operatoritaliccorrectionclassoptioncode \ -noligaturingglyphoptioncode nokerningglyphoptioncode noleftligatureglyphoptioncode noleftkernglyphoptioncode norightligatureglyphoptioncode \ -norightkernglyphoptioncode noexpansionglyphoptioncode noprotrusionglyphoptioncode noitaliccorrectionglyphoptioncode nokerningcode \ -noligaturingcode frozenflagcode tolerantflagcode protectedflagcode primitiveflagcode \ -permanentflagcode noalignedflagcode immutableflagcode mutableflagcode globalflagcode \ -overloadedflagcode immediateflagcode conditionalflagcode valueflagcode instanceflagcode \ -ordmathflattencode binmathflattencode relmathflattencode punctmathflattencode innermathflattencode \ -normalworddiscoptioncode preworddiscoptioncode postworddiscoptioncode continueifinputfile continuewhenlmtxmode \ -continuewhenmkivmode +accenttopskewwithoffsetmathcontrolcode ignorekerndimensionsmathcontrolcode ignoreflataccentsmathcontrolcode extendaccentsmathcontrolcode noligaturingglyphoptioncode \ +nokerningglyphoptioncode noexpansionglyphoptioncode noprotrusionglyphoptioncode noleftkerningglyphoptioncode noleftligaturingglyphoptioncode \ +norightkerningglyphoptioncode norightligaturingglyphoptioncode noitaliccorrectionglyphoptioncode islargeoperatorglyphoptioncode hasitalicshapeglyphoptioncode \ +normalparcontextcode vmodeparcontextcode vboxparcontextcode vtopparcontextcode vcenterparcontextcode \ +vadjustparcontextcode insertparcontextcode outputparcontextcode alignparcontextcode noalignparcontextcode \ +spanparcontextcode resetparcontextcode leftoriginlistanchorcode leftheightlistanchorcode leftdepthlistanchorcode \ +rightoriginlistanchorcode rightheightlistanchorcode rightdepthlistanchorcode centeroriginlistanchorcode centerheightlistanchorcode \ +centerdepthlistanchorcode halfwaytotallistanchorcode halfwayheightlistanchorcode halfwaydepthlistanchorcode halfwayleftlistanchorcode \ +halfwayrightlistanchorcode negatexlistsigncode negateylistsigncode negatelistsigncode fontslantperpoint \ +fontinterwordspace fontinterwordstretch fontinterwordshrink fontexheight fontemwidth \ +fontextraspace slantperpoint mathexheight mathemwidth interwordspace \ +interwordstretch interwordshrink exheight emwidth extraspace \ +mathaxisheight muquad startmode stopmode startnotmode \ +stopnotmode startmodeset stopmodeset doifmode doifelsemode \ +doifmodeelse doifnotmode startmodeset stopmodeset startallmodes \ +stopallmodes startnotallmodes stopnotallmodes doifallmodes doifelseallmodes \ +doifallmodeselse doifnotallmodes startenvironment stopenvironment environment \ +startcomponent stopcomponent component startproduct stopproduct \ +product startproject stopproject project starttext \ +stoptext startnotext stopnotext startdocument stopdocument \ +documentvariable unexpandeddocumentvariable setupdocument presetdocument doifelsedocumentvariable \ +doifdocumentvariableelse doifdocumentvariable doifnotdocumentvariable startmodule stopmodule \ +usemodule usetexmodule useluamodule setupmodule currentmoduleparameter \ +moduleparameter everystarttext everystoptext startTEXpage stopTEXpage \ +enablemode disablemode preventmode definemode globalenablemode \ +globaldisablemode globalpreventmode pushmode popmode typescriptone \ +typescripttwo typescriptthree mathsizesuffix mathordinarycode mathordcode \ +mathoperatorcode mathopcode mathbinarycode mathbincode mathrelationcode \ +mathrelcode mathopencode mathclosecode mathpunctuationcode mathpunctcode \ +mathovercode mathundercode mathinnercode mathradicalcode mathfractioncode \ +mathmiddlecode mathaccentcode mathfencedcode mathghostcode mathvariablecode \ +mathactivecode mathvcentercode mathconstructcode mathwrappedcode mathbegincode \ +mathendcode mathexplicitcode mathdivisioncode mathfactorialcode mathdimensioncode \ +mathexperimentalcode mathtextpunctuationcode mathimaginarycode mathdifferentialcode mathexponentialcode \ +mathellipsiscode mathfunctioncode mathdigitcode mathalphacode mathboxcode \ +mathchoicecode mathnothingcode mathlimopcode mathnolopcode mathunsetcode \ +mathunspacedcode mathallcode mathfakecode mathunarycode mathmaybeordinarycode \ +mathmayberelationcode mathmaybebinarycode mathnumbergroupcode constantnumber constantnumberargument \ +constantdimen constantdimenargument constantemptyargument luastringsep !!bs \ +!!es lefttorightmark righttoleftmark lrm rlm \ +bidilre bidirle bidipop bidilro bidirlo \ +breakablethinspace nobreakspace nonbreakablespace narrownobreakspace zerowidthnobreakspace \ +ideographicspace ideographichalffillspace twoperemspace threeperemspace fourperemspace \ +fiveperemspace sixperemspace figurespace punctuationspace hairspace \ +enquad emquad zerowidthspace zerowidthnonjoiner zerowidthjoiner \ +zwnj zwj optionalspace asciispacechar softhyphen \ +autoinsertedspace Ux eUx Umathaccents parfillleftskip \ +parfillrightskip startlmtxmode stoplmtxmode startmkivmode stopmkivmode \ +wildcardsymbol normalhyphenationcode automatichyphenationcode explicithyphenationcode syllablehyphenationcode \ +uppercasehyphenationcode collapsehyphenationcode compoundhyphenationcode strictstarthyphenationcode strictendhyphenationcode \ +automaticpenaltyhyphenationcode explicitpenaltyhyphenationcode permitgluehyphenationcode permitallhyphenationcode permitmathreplacehyphenationcode \ +forcecheckhyphenationcode lazyligatureshyphenationcode forcehandlerhyphenationcode feedbackcompoundhyphenationcode ignoreboundshyphenationcode \ +partialhyphenationcode completehyphenationcode normalizelinenormalizecode parindentskipnormalizecode swaphangindentnormalizecode \ +swapparsshapenormalizecode breakafterdirnormalizecode removemarginkernsnormalizecode clipwidthnormalizecode flattendiscretionariesnormalizecode \ +discardzerotabskipsnormalizecode flattenhleadersnormalizecode normalizeparnormalizeparcode flattenvleadersnormalizeparcode nopreslackclassoptioncode \ +nopostslackclassoptioncode lefttopkernclassoptioncode righttopkernclassoptioncode leftbottomkernclassoptioncode rightbottomkernclassoptioncode \ +lookaheadforendclassoptioncode noitaliccorrectionclassoptioncode defaultmathclassoptions checkligatureclassoptioncode checkitaliccorrectionclassoptioncode \ +checkkernpairclassoptioncode flattenclassoptioncode omitpenaltyclassoptioncode unpackclassoptioncode raiseprimeclassoptioncode \ +carryoverlefttopkernclassoptioncode carryoverleftbottomkernclassoptioncode carryoverrighttopkernclassoptioncode carryoverrightbottomkernclassoptioncode preferdelimiterdimensionsclassoptioncode \ +autoinjectclassoptioncode removeitaliccorrectionclassoptioncode operatoritaliccorrectionclassoptioncode noligaturingglyphoptioncode nokerningglyphoptioncode \ +noleftligatureglyphoptioncode noleftkernglyphoptioncode norightligatureglyphoptioncode norightkernglyphoptioncode noexpansionglyphoptioncode \ +noprotrusionglyphoptioncode noitaliccorrectionglyphoptioncode nokerningcode noligaturingcode frozenflagcode \ +tolerantflagcode protectedflagcode primitiveflagcode permanentflagcode noalignedflagcode \ +immutableflagcode mutableflagcode globalflagcode overloadedflagcode immediateflagcode \ +conditionalflagcode valueflagcode instanceflagcode ordmathflattencode binmathflattencode \ +relmathflattencode punctmathflattencode innermathflattencode normalworddiscoptioncode preworddiscoptioncode \ +postworddiscoptioncode continueifinputfile continuewhenlmtxmode continuewhenmkivmode keywordclass.context.helpers=\ startsetups stopsetups startxmlsetups stopxmlsetups \ diff --git a/context/data/scite/context/scite-context-data-tex.properties b/context/data/scite/context/scite-context-data-tex.properties index d6f016425..8675453ea 100644 --- a/context/data/scite/context/scite-context-data-tex.properties +++ b/context/data/scite/context/scite-context-data-tex.properties @@ -133,8 +133,8 @@ tpack tracingadjusts tracingalignments tracingexpressions tracingfonts \ tracingfullboxes tracinghyphenation tracinginserts tracinglevels tracingmarks \ tracingmath tracingnodes tracingpenalties uleaders undent \ unexpandedloop unhpack unletfrozen unletprotected untraced \ -unvpack vpack wordboundary wrapuppar xdefcsname \ -xtoks xtoksapp xtokspre +unvpack variablefam vpack wordboundary wrapuppar \ +xdefcsname xtoks xtoksapp xtokspre keywordclass.tex.omega=\ Omegaminorversion Omegarevision Omegaversion diff --git a/doc/context/documents/general/manuals/luametatex.pdf b/doc/context/documents/general/manuals/luametatex.pdf Binary files differindex e540e7f6d..432cf05e4 100644 --- a/doc/context/documents/general/manuals/luametatex.pdf +++ b/doc/context/documents/general/manuals/luametatex.pdf diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex b/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex index 1bbdebb09..64eb06bc9 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-fonts.tex @@ -107,6 +107,11 @@ in combination with \LUA\ code that does this. In \CONTEXT\ we have base mode that uses the engine, and node mode that uses \LUA. A monospaced font normally has no ligatures and kerns and is normally not processed at all. +We can group the parameters. All characters have the following base set. It must +be noted here that \OPENTYPE\ doesn't have a italic property and that the height +and depth are also not part of the design: one can choose to derive them from the +bounding box. + \starttabulate[|l|l|pl|] \DB key \BC type \BC description \NC\NR \TB @@ -114,24 +119,87 @@ has no ligatures and kerns and is normally not processed at all. \NC \type {height} \NC number \NC height in sp (default 0) \NC\NR \NC \type {depth} \NC number \NC depth in sp (default 0) \NC\NR \NC \type {italic} \NC number \NC italic correction in sp (default 0) \NC\NR -\NC \type {topaccent} \NC number \NC top accent alignment place in sp (default zero) \NC\NR -\NC \type {bottomaccent} \NC number \NC bottom accent alignment place, in sp (default zero) \NC\NR +\stoptabulate + +Then there are three parameters that are more optional and relate to advanced +optical paragraph optimization: + +\starttabulate[|l|l|pl|] +\DB key \BC type \BC description \NC\NR +\TB \NC \type {leftprotruding} \NC number \NC left protruding factor (\prm {lpcode}) \NC\NR \NC \type {rightprotruding} \NC number \NC right protruding factor (\prm {rpcode}) \NC\NR \NC \type {expansion} \NC number \NC expansion factor (\prm {efcode}) \NC\NR -\NC \type {next} \NC number \NC \quote {next larger} character index \NC\NR -\NC \type {extensible} \NC table \NC constituent parts of an extensible (traditional) recipe \NC\NR -\NC \type {vparts} \NC table \NC constituent parts of a vertical (\OPENTYPE) recipe \NC \NR -\NC \type {hparts} \NC table \NC constituent parts of a horizontal (\OPENTYPE)recipe \NC \NR -\NC \type {kerns} \NC table \NC kerning information \NC\NR +\stoptabulate + +From \TEX\ we inherit the following tables. Ligatures are only used in so call +base mode, when the engine does the font magic. Kerns are used in text and +optionally in math: More details follow below. + +\starttabulate[|l|l|pl|] +\DB key \BC type \BC description \NC\NR +\TB \NC \type {ligatures} \NC table \NC ligaturing information \NC\NR -\NC \type {mathkern} \NC table \NC math cut-in specifications \NC\NR -\NC \type {smaller} \NC number \NC the next smaller math size character \NC\NR +\NC \type {kerns} \NC table \NC kerning information \NC\NR +\stoptabulate + +The next two fields control the engine and are a variant on \TEX's \TFM\ tag +property. In a future we might provide a bit more (local) control although +currently we see no need. Originally the tag and next field were combined into a +packed integer but in current \LUAMETATEX\ we have a 32 bit tag and the next +field moved to the math blob as it only is used as variant selector. + +\starttabulate[|l|l|pl|] +\DB key \BC type \BC description \NC\NR +\TB +\NC \type {tag} \NC number \NC a bitset, currently not really exposed \NC\NR +%NC \type {reserved} \NC number \NC note for myself \NC \NR +\stoptabulate + +In a math font characters have many more fields. + +\starttabulate[|l|l|pl|] +\DB key \BC type \BC description \NC\NR +\TB +\NC \type {smaller} \NC number \NC the next smaller math size character \NC\NR +\NC \type {mirror} \NC number \NC a right to left alternative \NC\NR +\NC \type {flataccent} \NC number \NC an accent alternative with less height (\OPENTYPE) \NC\NR +\NC \type {next} \NC number \NC \quote {next larger} character index \NC\NR +\HL +\NC \type {topleft} \NC number \NC alternative script kern \NC\NR +\NC \type {topright} \NC number \NC alternative script kern \NC\NR +\NC \type {bottomleft} \NC number \NC alternative script kern \NC\NR +\NC \type {bottomright} \NC number \NC alternative script kern \NC\NR +\HL +\NC \type {topmargin} \NC number \NC alternative accent calculation margin \NC\NR +\NC \type {bottomargin} \NC number \NC alternative accent calculation margin \NC\NR +\NC \type {leftmargin} \NC number \NC alternative accent calculation margin \NC\NR +\NC \type {rightmargin} \NC number \NC alternative accent calculation margin \NC\NR +\HL +\NC \type {topovershoot} \NC number \NC accent width tolerance \NC\NR +\NC \type {bottomovershoot} \NC number \NC accent width tolerance \NC\NR +\HL +\NC \type {topanchor} \NC number \NC horizontal top accent alignment position \NC\NR +\NC \type {bottomanchor} \NC number \NC horizontal bottom accent alignment position \NC\NR +\HL +\NC \type {innerlocation} \NC string \NC \type {left} or \type {right} \NC\NR +\NC \type {innerxoffset} \NC number \NC radical degree horizontal position \NC\NR +\NC \type {inneryoffset} \NC number \NC radical degree vertical position \NC\NR +\HL +\NC \type {parts} \NC table \NC constituent parts of an extensible \NC \NR +\NC \type {partsitalic} \NC number \NC the italic correction applied with the extensible \NC \NR +\NC \type {partsorientation} \NC number \NC \type {horizontal} or \type {vertical} \NC\NR +\HL +\NC \type {mathkerns} \NC table \NC math cut-in specifications \NC\NR +\HL +\NC \type {extensible} \NC table \NC stretch a fixed width accent to fit\NC\NR \LL \stoptabulate -For example, here is the character \quote {f} (decimal 102) in the font \type -{cmr10 at 10pt}. The numbers that represent dimensions are in scaled points. +Now some more details follow. For example, here is the character \quote {f} +(decimal 102) in the font \type {cmr10 at 10pt}. The numbers that represent +dimensions are in scaled points. Of course you will use Latin Modern \OPENTYPE\ +instead but the principles are the same: \starttyping [102] = { @@ -159,17 +227,23 @@ virtual character whose ligatures and kerns are used to handle word boundary processing. \type {rightboundary} is similar but not actually used for anything (yet). -The values of \type {topaccent}, \type {bottomaccent} and \type {mathkern} are +The values of \type {leftprotrusion} and \type {rightprotrusion} are used only +when \prm {protrudechars} is non-zero. Whether or not \type {expansion} is used +depends on the font's global expansion settings, as well as on the value of \prm +{adjustspacing}. + +The values of \type {topanchor}, \type {bottomanchor} and \type {mathkern} are used only for math accent and superscript placement, see \at {page} [math] in -this manual for details. The values of \type {leftprotrusion} and \type -{rightprotrusion} are used only when \prm {protrudechars} is non-zero. Whether or -not \type {expansion} is used depends on the font's global expansion settings, as -well as on the value of \prm {adjustspacing}. +this manual for details. The italic corrections are a story in themselves and +discussed in detail in other manuals. The additional parameters that deal with +kerns, margins, overshoots, inner anchoring, etc. are engine specific and not +part of \OPENTYPE. More information can be found in the \CONTEXT\ distribution; +they relate the upgraded math engine project by Mikael and Hans. A math character can have a \type {next} field that points to a next larger shape. However, the presence of \type {extensible} will overrule \type {next}, if that is also present. The \type {extensible} field in turn can be overruled by -\type {vparts}, the \OPENTYPE\ version. The \type {extensible} table is very +\type {parts}, the \OPENTYPE\ version. The \type {extensible} table is very simple: \starttabulate[|l|l|p|] @@ -182,8 +256,8 @@ simple: \LL \stoptabulate -The \type {hparts} and \type {vparts} are arrays of components. Each of -those components is itself a hash of up to five keys: +The \type {parts} entru is an arrays of components. Each of those components is +itself a hash of up to five keys: \starttabulate[|l|l|p|] \DB key \BC type \BC explanation \NC \NR @@ -198,15 +272,15 @@ those components is itself a hash of up to five keys: \LL \stoptabulate -The \type {kerns} table is a hash indexed by character index (and \quote -{character index} is defined as either a non|-|negative integer or the string -value \type {rightboundary}), with the values of the kerning to be applied, in -scaled points. +The traditional (text and math) \type {kerns} table is a hash indexed by +character index (and \quote {character index} is defined as either a +non|-|negative integer or the string value \type {rightboundary}), with the +values of the kerning to be applied, in scaled points. -The \type {ligatures} table is a hash indexed by character index (and \quote -{character index} is defined as either a non|-|negative integer or the string -value \type {rightboundary}), with the values being yet another small hash, with -two fields: +The traditional (text) \type {ligatures} table is a hash indexed by character +index (and \quote {character index} is defined as either a non|-|negative integer +or the string value \type {rightboundary}), with the values being yet another +small hash, with two fields: \starttabulate[|l|l|p|] \DB key \BC type \BC description \NC \NR @@ -243,46 +317,53 @@ The default value is~0, and can be left out. That signifies a \quote {normal} ligature where the ligature replaces both original glyphs. In this table the~\type {|} indicates the final insertion point. -The \type {mathcontrol} bitset is mostly there for experimental purposes. Because -there is inconsistency in the \OPENTYPE\ math fonts with respect to for instance -glyph dimensions, it is possible to force the traditional code path. We just mention -the possible flags: - -\startluacode - context.starttabulate { "|||" } - context.DB() context("value") context.BC() context("effect") context.NC() context.NR() - context.TB() - for k, v in table.sortedhash(tex.getmathcontrolvalues()) do - context.NC() context("0x%04X",k) context.NC() context(v) context.NC() context.NR() - end - context.LL() - context.stoptabulate() -\stopluacode +% The \type {mathcontrol} bitset is mostly there for experimental purposes. Because +% there is inconsistency in the \OPENTYPE\ math fonts with respect to for instance +% glyph dimensions, it is possible to force the traditional code path. We just mention +% the possible flags: +% +% \startluacode +% context.starttabulate { "|||" } +% context.DB() context("value") context.BC() context("effect") context.NC() context.NR() +% context.TB() +% for k, v in table.sortedhash(tex.getmathcontrolvalues()) do +% context.NC() context("0x%04X",k) context.NC() context(v) context.NC() context.NR() +% end +% context.LL() +% context.stoptabulate() +% \stopluacode Compact math is an experimental feature. The smaller field in a character definition of a text character can point to a script character that itself can point to a scriptscript one. When set the \type {textscale}, \type {scriptscale} and \type {scriptscriptscale} is applied to those. -The \type {textcontrol} field is used to control some aspects of text processing. -More options might be added in the future. - -\startluacode - context.starttabulate { "|||" } - context.DB() context("value") context.BC() context("effect") context.NC() context.NR() - context.TB() - for k, v in table.sortedhash(tex.gettextcontrolvalues()) do - context.NC() context("0x%04X",k) context.NC() context(v) context.NC() context.NR() - end - context.LL() - context.stoptabulate() -\stopluacode - -In \CONTEXT\ these are interfaced via pseudo features. The math control flags of -a font can be overloaded by \prm {mathcontrolmode} on the spot and the set -controls of a font can be queried by \prm {fontmathcontrol}. The text control -flags in a font always win over the ones set by other parameters, like \prm -{hyphenationmode}. They can be queried with \prm {fonttextcontrol}. +Bidirectional math is also experimental and driven by (in \CONTEXT\ speak) tweaks +which means that it has to be set up explicitly as it uses a combination of +fonts. In \CONTEXT\ is also uses specific features of the font subsystems that +hook into the backend where we have a more advanced virtual font subsystem than +in \LUATEX. Because this is macro package dependent it will not be discussed +here. + +% The \type {textcontrol} field is used to control some aspects of text processing. +% More options might be added in the future. + +% \startluacode +% context.starttabulate { "|||" } +% context.DB() context("value") context.BC() context("effect") context.NC() context.NR() +% context.TB() +% for k, v in table.sortedhash(tex.gettextcontrolvalues()) do +% context.NC() context("0x%04X",k) context.NC() context(v) context.NC() context.NR() +% end +% context.LL() +% context.stoptabulate() +% \stopluacode +% +% In \CONTEXT\ these are interfaced via pseudo features. The math control flags of +% a font can be overloaded by \prm {mathcontrolmode} on the spot and the set +% controls of a font can be queried by \prm {fontmathcontrol}. The text control +% flags in a font always win over the ones set by other parameters, like \prm +% {hyphenationmode}. They can be queried with \prm {fonttextcontrol}. \stopsection diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-math.tex b/doc/context/sources/general/manuals/luametatex/luametatex-math.tex index 88d3eafc3..66a62ee72 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-math.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-math.tex @@ -2192,7 +2192,9 @@ influence the spacing. The numbers are the same as for character classes. \topicindex {math+codes} -You can extract the components of a math character. Say that we have defined: +You should not really depend on the number that comes from \prm {Umathcode} because +the engine can (at some point) use a different amount of families and classes. Given this, +you can extract the components of a math character. Say that we have defined: \starttyping \Umathcode 1 2 3 4 @@ -2201,17 +2203,21 @@ You can extract the components of a math character. Say that we have defined: then \starttyping -[\Umathcharclass1] [\Umathcharfam1] [\Umathcharslot1] +[\Umathcharclass\Umathcode1] [\Umathcharfam\Umathcode1] [\Umathcharslot\Umathcode1] \stoptyping -will return: +which will return: \starttyping [2] [3] [4] \stoptyping -These commands are provided as convenience. Before they come available you could -do the following: +You can of course store the code in for instance a register and use that as +argument. The three commands also accept a specification (and maybe more in the +future). + +These commands are provided as convenience. Before they became available you +could do the following: \starttyping \def\Umathcharclass{\numexpr diff --git a/doc/context/sources/general/manuals/luametatex/luametatex.tex b/doc/context/sources/general/manuals/luametatex/luametatex.tex index aead9b304..96f700355 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex.tex @@ -110,6 +110,8 @@ \ifdefined\linebuffering \linebuffering \fi \enableexperiments[fonts.compact] +%disableexperiments[fonts.accurate] + % \enabledirectives[fonts.injections.method=advance] % tricky ... not all xoffsets are advance robust % This is only for testing, use the command line (or banner line) instead. diff --git a/doc/context/sources/general/manuals/luatex/luatex-math.tex b/doc/context/sources/general/manuals/luatex/luatex-math.tex index 4ab65fa18..4b86c5864 100644 --- a/doc/context/sources/general/manuals/luatex/luatex-math.tex +++ b/doc/context/sources/general/manuals/luatex/luatex-math.tex @@ -130,6 +130,20 @@ sections: \LL \stoptabulate +Instead of the pseudo class variable (7) you can use a family number as signal +for using the current family. This permits classifying characters with a class +and still let the family adapt. The trigger family is set with \lpr +{variablefam}. So: + +\starttyping +\variablefam"24 +\Umathchardef\foo "3 "24 123 +\foo \fam9 +\stoptyping + +Results in a curly left brace taken from family 9 with class \quote {relation} +and spacing around it will be accordingly. + \stopsection \startsection[title={Math styles}] @@ -774,13 +788,13 @@ right end. The question is: how often is this implemented, and if so, do the kerns assume correction too. Anyway, with this parameter one can control it. \starttabulate[|l|ck1|ck1|ck1|ck1|ck1|ck1|] - \NC - \NC \mathnolimitsmode0 $\displaystyle\int\nolimits^0_1$ - \NC \mathnolimitsmode1 $\displaystyle\int\nolimits^0_1$ - \NC \mathnolimitsmode2 $\displaystyle\int\nolimits^0_1$ - \NC \mathnolimitsmode3 $\displaystyle\int\nolimits^0_1$ - \NC \mathnolimitsmode4 $\displaystyle\int\nolimits^0_1$ - \NC \mathnolimitsmode8000 $\displaystyle\int\nolimits^0_1$ + \NC % probably not ok, we need a raw int here + \NC \mathnolimitsmode0 $\displaystyle\mathop{\normalint}\nolimits^0_1$ + \NC \mathnolimitsmode1 $\displaystyle\mathop{\normalint}\nolimits^0_1$ + \NC \mathnolimitsmode2 $\displaystyle\mathop{\normalint}\nolimits^0_1$ + \NC \mathnolimitsmode3 $\displaystyle\mathop{\normalint}\nolimits^0_1$ + \NC \mathnolimitsmode4 $\displaystyle\mathop{\normalint}\nolimits^0_1$ + \NC \mathnolimitsmode8000 $\displaystyle\mathop{\normalint}\nolimits^0_1$ \NC \NR \TB \BC mode diff --git a/metapost/context/base/mpxl/mp-lmtx.mpxl b/metapost/context/base/mpxl/mp-lmtx.mpxl index acf3dcbef..f26af8a60 100644 --- a/metapost/context/base/mpxl/mp-lmtx.mpxl +++ b/metapost/context/base/mpxl/mp-lmtx.mpxl @@ -2614,3 +2614,66 @@ vardef lmt_do_matrix = popparameters ) enddef ; + +% This might move to its own module if we add more: + +presetparameters "glyphshape" [ + % id = "", + % character = "", + shape = true, + boundingbox = false, + baseline = false, + usedline = true, + usedbox = true, +] ; + +def lmt_glyphshape = applyparameters "glyphshape" "lmt_do_glyphshape" enddef ; + +vardef glyphshape_start(expr id, character) = + lua.mp.lmt_glyphshape_start(id, character) ; +enddef ; + +vardef glyphshape_stop = lua.mp.lmt_glyphshape_stop() ; enddef ; +vardef glyphshape_n = lua.mp.lmt_glyphshape_n() enddef ; +vardef glyphshape_path(expr i) = lua.mp.lmt_glyphshape_path(i) enddef ; +vardef glyphshape_boundingbox = lua.mp.lmt_glyphshape_boundingbox() enddef ; +vardef glyphshape_baseline = lua.mp.lmt_glyphshape_baseline() enddef ; +vardef glyphshape_usedbox = lua.mp.lmt_glyphshape_usedbox() enddef ; +vardef glyphshape_usedline = lua.mp.lmt_glyphshape_usedline() enddef ; +vardef glyphshape_width = lua.mp.lmt_glyphshape_width() enddef ; +vardef glyphshape_height = lua.mp.lmt_glyphshape_height() enddef ; +vardef glyphshape_depth = lua.mp.lmt_glyphshape_depth() enddef ; +vardef glyphshape_italic = lua.mp.lmt_glyphshape_italic() enddef ; +vardef glyphshape_accent = lua.mp.lmt_glyphshape_accent() enddef ; + +vardef lmt_do_glyphshape = + image ( + pushparameters "glyphshape" ; + lua.mp.lmt_glyphshape_start(getparameter "id", getparameter "character") ; + if getparameter "shape" : + draw for i=1 upto lua.mp.lmt_glyphshape_n() : + lua.mp.lmt_glyphshape_path(i) && + endfor cycle ; + fi ; + if getparameter "boundingbox" : + draw + lua.mp.lmt_glyphshape_boundingbox() + withcolor red + ; + fi ; + if getparameter "usedline" : + draw + lua.mp.lmt_glyphshape_usedline() + withcolor green + ; + fi ; + if getparameter "usedbox" : + draw + lua.mp.lmt_glyphshape_usedbox() + withcolor blue + ; + fi ; + lua.mp.lmt_glyphshape_stop() ; + popparameters ; + ) +enddef ; diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index c39b8907f..25be6890a 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -16,7 +16,7 @@ local lower, gsub = string.lower, string.gsub local concat = table.concat local write_nl = (logs and logs.writer) or (texio and texio.write_nl) or print -local otlversion = 3.121 +local otlversion = 3.130 local helpinfo = [[ <?xml version="1.0"?> diff --git a/scripts/context/lua/mtx-install.lua b/scripts/context/lua/mtx-install.lua index 1eb7e88c9..7efd8f5ed 100644 --- a/scripts/context/lua/mtx-install.lua +++ b/scripts/context/lua/mtx-install.lua @@ -124,9 +124,9 @@ local platforms = { -- ["linux-armhf"] = "linux-armhf", -- - ["openbsd"] = "openbsd7.0", - ["openbsd-i386"] = "openbsd7.0", - ["openbsd-amd64"] = "openbsd7.0-amd64", + ["openbsd"] = "openbsd7.2", + ["openbsd-i386"] = "openbsd7.2", + ["openbsd-amd64"] = "openbsd7.2-amd64", -- ["freebsd"] = "freebsd", ["freebsd-i386"] = "freebsd", diff --git a/scripts/context/lua/mtx-update.lua b/scripts/context/lua/mtx-update.lua index bd4f2f56b..daf23eb09 100644 --- a/scripts/context/lua/mtx-update.lua +++ b/scripts/context/lua/mtx-update.lua @@ -178,9 +178,9 @@ update.platforms = { -- ["linux-armhf"] = "linux-armhf", -- - ["openbsd"] = "openbsd7.1", - ["openbsd-i386"] = "openbsd7.1", - ["openbsd-amd64"] = "openbsd7.1-amd64", + ["openbsd"] = "openbsd7.2", + ["openbsd-i386"] = "openbsd7.2", + ["openbsd-amd64"] = "openbsd7.2-amd64", -- ["freebsd"] = "freebsd", ["freebsd-i386"] = "freebsd", diff --git a/source/luametatex/CMakeLists.txt b/source/luametatex/CMakeLists.txt index a5021595f..13a7770c5 100644 --- a/source/luametatex/CMakeLists.txt +++ b/source/luametatex/CMakeLists.txt @@ -14,7 +14,7 @@ include(GNUInstallDirs) # optionals at some time, but for now we enable them (there is not not much code involved). The # idea behind thes eoptionals is that we have very simple (!) interfaces, delegating as much as # possible to Lua. We will *not* add interfaces with many bindings because that will introduce -# dependencies (and looking at e.g. LuaTeX build updates shows thatc clearly: a no-go). +# dependencies (and looking at e.g. LuaTeX build updates shows that clearly: a no-go). set(LMT_KPSE_TOO 1) # In case we want to manage MKII scripts (etc) with mtxrun. set(LMT_HB_TOO 1) # Maybe handy for Idris' font development (old converted ffi stuff) @@ -177,6 +177,10 @@ if (CMAKE_C_COMPILER_ID STREQUAL "Clang") -Wno-missing-noreturn -Wno-implicit-fallthrough # -Wno-format + -Wno-reserved-identifier + -Wno-date-time + -Wno-format-nonliteral + -Wno-float-equal ) endif() diff --git a/source/luametatex/cmake/luasocket.cmake b/source/luametatex/cmake/luasocket.cmake index 8489b0a80..e36f1f7e6 100644 --- a/source/luametatex/cmake/luasocket.cmake +++ b/source/luametatex/cmake/luasocket.cmake @@ -51,6 +51,14 @@ if (WIN32) ) endif() +# It seems to depend on the mingw installation: + +if (__MINGW64_TOOLCHAIN_) + target_compile_definitions(luasocket PRIVATE + LUASOCKET_INET_PTON + ) +endif() + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") target_compile_definitions(luasocket PRIVATE LUASOCKET_INET_PTON diff --git a/source/luametatex/cmake/mingw-32.cmake b/source/luametatex/cmake/mingw-32.cmake index ef5001226..6a06431d5 100644 --- a/source/luametatex/cmake/mingw-32.cmake +++ b/source/luametatex/cmake/mingw-32.cmake @@ -1,6 +1,6 @@ -if (NOT __MINGW64_TOOLCHAIN_) - add_compile_options(-DLUASOCKET_INET_PTON) -endif() +# if (NOT __MINGW64_TOOLCHAIN_) +# add_compile_options(-DLUASOCKET_INET_PTON) +# endif() set(CMAKE_SYSTEM_NAME Windows) set(TOOLCHAIN_PREFIX i686-w64-mingw32) diff --git a/source/luametatex/cmake/mingw-64.cmake b/source/luametatex/cmake/mingw-64.cmake index c57bed871..294ef5e55 100644 --- a/source/luametatex/cmake/mingw-64.cmake +++ b/source/luametatex/cmake/mingw-64.cmake @@ -1,6 +1,6 @@ -if (NOT __MINGW64_TOOLCHAIN_) - add_compile_options(-DLUASOCKET_INET_PTON) -endif() +# if (NOT __MINGW64_TOOLCHAIN_) +# add_compile_options(-DLUASOCKET_INET_PTON) +# endif() set(CMAKE_SYSTEM_NAME Windows) set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) diff --git a/source/luametatex/cmake/mp.cmake b/source/luametatex/cmake/mp.cmake index 1d064101d..22680cdb7 100644 --- a/source/luametatex/cmake/mp.cmake +++ b/source/luametatex/cmake/mp.cmake @@ -38,6 +38,12 @@ target_compile_definitions(mp PUBLIC DECNUMDIGITS=1000 ) +if (CMAKE_C_COMPILER_ID STREQUAL "Clang") + target_compile_options(mp PRIVATE + -Wno-unreachable-code-break + ) +endif() + if (NOT MSVC) target_compile_options(mp PRIVATE -Wno-unused-parameter @@ -46,5 +52,5 @@ if (NOT MSVC) -Wno-cast-align # for decnumber with lto -fno-strict-aliasing -) + ) endif() diff --git a/source/luametatex/source/libraries/avl/avl.c b/source/luametatex/source/libraries/avl/avl.c index 46e0bcd50..e1c18ceb5 100644 --- a/source/luametatex/source/libraries/avl/avl.c +++ b/source/luametatex/source/libraries/avl/avl.c @@ -1442,7 +1442,7 @@ avl_code_t avl_del_first(avl_tree t, void **backup) if (t && t->root) { avl_code_t rv; if (backup) { - ptr_handler h = { NULL, OP_BACKUP }; + ptr_handler h = { NULL, OP_BACKUP, 0 }; rv = node_del_first(t, &h); *backup = h.ptr; } else { @@ -1460,7 +1460,7 @@ avl_code_t avl_del_last(avl_tree t, void **backup) if (backup == NULL) { return node_del_last(t, NULL); } else { - ptr_handler h = { NULL, OP_BACKUP }; + ptr_handler h = { NULL, OP_BACKUP, 0 }; avl_code_t rv = node_del_last(t, &h); *backup = h.ptr; return rv; @@ -1527,7 +1527,7 @@ void avl_cat(avl_tree t0, avl_tree t1) return; } else if (t0->root) { int delta = depth(t1->root) - depth(t0->root); - ptr_handler h = { NULL, OP_DETACH }; + ptr_handler h = { NULL, OP_DETACH, 0 }; if (delta <= 0) { if (node_del_first (t1, &h) == 2) { --delta; @@ -1559,13 +1559,13 @@ void avl_cat(avl_tree t0, avl_tree t1) avl_code_t avl_split(const void *item, avl_tree t, avl_tree t0, avl_tree t1) { if (t && t->root) { + avl_compare_func cmp = t->compare; + avl_node *a, *p, *sn; /* sn: split node */ + int k, na, an[AVL_STACK_CAPACITY]; t0->root = NULL; t1->root = NULL; t0->count = 0; t1->count = 0; - avl_compare_func cmp = t->compare; - avl_node *a, *p, *sn; /* sn: split node */ - int k, na, an[AVL_STACK_CAPACITY]; /* invariant: [na]= size of tree rooted at [a] plus one */ for (a = t->root, na = (int) (t->count + 1), k = 0;;) { int d_ = item_compare(cmp, t, item, get_item(a)); diff --git a/source/luametatex/source/libraries/hnj/hnjhyphen.c b/source/luametatex/source/libraries/hnj/hnjhyphen.c index ad9d87683..cde68cb93 100644 --- a/source/luametatex/source/libraries/hnj/hnjhyphen.c +++ b/source/luametatex/source/libraries/hnj/hnjhyphen.c @@ -552,7 +552,7 @@ void hnj_dictionary_load(hjn_dictionary *dict, const unsigned char *f, int trace char *newpat_pat = lookup_pattern(dict->merged, word, l1); if (! newpat_pat) { char *neworg; - unsigned char *newword = (unsigned char *) hnj_malloc((size_t) (l1 + 1)); + unsigned char *newword = (unsigned char *) hnj_malloc(l1 + 1); int e1 = 0; strncpy((char *) newword, (char *) word, (size_t) l1); newword[l1] = 0; @@ -561,7 +561,7 @@ void hnj_dictionary_load(hjn_dictionary *dict, const unsigned char *f, int trace e1++; } } - neworg = hnj_malloc((size_t) (l1 + 2 - e1)); + neworg = hnj_malloc(l1 + 2 - e1); /*tex Fill with right amount of zeros: */ sprintf(neworg, "%0*d", l1 + 1 - e1, 0); insert_pattern(dict->merged, newword, combine_patterns(neworg, subpat_pat), trace); diff --git a/source/luametatex/source/lua/lmtcallbacklib.c b/source/luametatex/source/lua/lmtcallbacklib.c index 8724cdd6f..a971b5e57 100644 --- a/source/luametatex/source/lua/lmtcallbacklib.c +++ b/source/luametatex/source/lua/lmtcallbacklib.c @@ -151,8 +151,8 @@ static int callbacklib_aux_run(lua_State *L, int id, int special, const char *va } else if (special == 2) { narg++; } + lmt_lua_state.saved_callback_count++; { - lmt_lua_state.saved_callback_count++; int i = lua_pcall(L, narg, nres, base); if (i) { /*tex diff --git a/source/luametatex/source/lua/lmtenginelib.c b/source/luametatex/source/lua/lmtenginelib.c index f8df06657..fef2ed819 100644 --- a/source/luametatex/source/lua/lmtenginelib.c +++ b/source/luametatex/source/lua/lmtenginelib.c @@ -320,8 +320,8 @@ static void enginelib_show_credits(void) "and has been extended in many aspects.\n" "\n" "There is a lightweight subsystem for optional libraries but here we also delegate as much\n" - "as possibe to Lua. A few interfaces are provided bny default, others can be added using a\n" - "simple foreign interface subsystem. Although this is provided an dconsidered part of the\n" + "as possible to Lua. A few interfaces are provided by default, others can be added using a\n" + "simple foreign interface subsystem. Although this is provided and considered part of the\n" "LuaMetaTeX engine it is not something ConTeXt depends (and will) depend on.\n" "\n" "version : " luametatex_version_string " | " LMT_TOSTRING(luametatex_development_id) "\n" @@ -433,7 +433,7 @@ static void enginelib_check_option(char **options, int i) */ -const char *suffixes[] = { "lmt", "lua", NULL }; +static const char *suffixes[] = { "lmt", "lua", NULL }; static void enginelib_parse_options(void) { diff --git a/source/luametatex/source/lua/lmtfontlib.c b/source/luametatex/source/lua/lmtfontlib.c index 5004a9710..953d3bcd1 100644 --- a/source/luametatex/source/lua/lmtfontlib.c +++ b/source/luametatex/source/lua/lmtfontlib.c @@ -248,11 +248,13 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int { if (lua_istable(L, -1)) { /*tex We need an intermediate veriable: */ - scaled target; - int state; + int target; + const char *starget; charinfo *co = tex_get_charinfo(f, i); - set_any_field_by_index(state, callback); - set_charinfo_tag(co, state ? callback_tag : 0); + set_numeric_field_by_index(target, tag, 0); + set_charinfo_tag(co, target ? tex_char_checked_tag(target) : 0); + set_any_field_by_index(target, callback); + set_charinfo_tag(co, target ? callback_tag : 0); set_numeric_field_by_index(target, width, 0); set_charinfo_width(co, target); set_numeric_field_by_index(target, height, 0); @@ -263,19 +265,20 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int set_charinfo_italic(co, target); set_numeric_field_by_index(target, expansion, 1000); set_charinfo_expansion(co, target); + set_numeric_field_by_index(target, compression, target); + set_charinfo_compression(co, target); set_numeric_field_by_index(target, leftprotrusion, 0); set_charinfo_leftprotrusion(co, target); set_numeric_field_by_index(target, rightprotrusion, 0); set_charinfo_rightprotrusion(co, target); - set_charinfo_tag(co, 0); if (has_math) { tex_char_malloc_mathinfo(co); set_numeric_field_by_index(target, smaller, 0); set_charinfo_smaller(co, target); set_numeric_field_by_index(target, mirror, 0); set_charinfo_mirror(co, target); - set_numeric_field_by_index(target, vitalic, 0); - set_charinfo_vertical_italic(co, target); + set_numeric_field_by_index(target, flataccent, INT_MIN); + set_charinfo_flat_accent(co, target); /* */ set_numeric_field_by_index(target, topleft, 0); set_charinfo_top_left_kern(co, target); @@ -304,83 +307,58 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int set_charinfo_top_anchor(co, target); set_numeric_field_by_index(target, bottomanchor, INT_MIN); set_charinfo_bottom_anchor(co, target); - set_numeric_field_by_index(target, flataccent, INT_MIN); - set_charinfo_flat_accent(co, target); + /* */ + set_string_field_by_index(starget, innerlocation); + if (lua_key_eq(starget, left)) { + set_charinfo_tag(co, inner_left_tag); + } else if (lua_key_eq(starget, right)) { + set_charinfo_tag(co, inner_right_tag); + } + set_numeric_field_by_index(target, innerxoffset, INT_MIN); + set_charinfo_inner_x_offset(co, target); + set_numeric_field_by_index(target, inneryoffset, INT_MIN); + set_charinfo_inner_y_offset(co, target); + /* */ set_numeric_field_by_index(target, next, -1); if (target >= 0) { set_charinfo_tag(co, list_tag); - set_charinfo_remainder(co, target); + set_charinfo_next(co, target); } - lua_push_key(extensible); - switch (lua_rawget(L, -2)) { - case LUA_TTABLE: - { - int top, bottom, middle, extender; - set_numeric_field_by_index(top, top, 0); - set_numeric_field_by_index(bottom, bottom, 0); - set_numeric_field_by_index(middle, middle, 0); - set_numeric_field_by_index(extender, extender, 0); - if (top || bottom || middle || extender) { - set_charinfo_tag(co, extension_tag); - tex_set_charinfo_extensible(co, top, bottom, middle, extender); - } else { - tex_formatted_warning("font", "lua-loaded font %s char U+%X has an invalid extensible field", font_name(f), (int) i); - } - } - break; - case LUA_TBOOLEAN: - if (lua_toboolean(L, -2)) { - set_charinfo_tag(co, extend_last_tag); - } - break; - } - lua_pop(L, 1); - lua_push_key(hparts); + set_boolean_field_by_index(target, extensible, 0); + if (target) { + set_charinfo_tag(co, extend_last_tag); + } + lua_push_key(parts); if (lua_rawget(L, -2) == LUA_TTABLE) { - set_charinfo_tag(co, extension_tag); - tex_set_charinfo_horizontal_parts(co, NULL); + set_charinfo_tag(co, extensible_tag); + tex_set_charinfo_extensible_recipe(co, NULL); for (lua_Integer k = 1; ; k++) { if (lua_rawgeti(L, -1, k) == LUA_TTABLE) { int glyph, startconnect, endconnect, advance, extender; - extinfo *h; set_numeric_field_by_index(glyph, glyph, 0); set_numeric_field_by_index(extender, extender, 0); set_numeric_field_by_index(startconnect, start, 0); set_numeric_field_by_index(endconnect, end, 0); set_numeric_field_by_index(advance, advance, 0); - h = tex_new_charinfo_part(glyph, startconnect, endconnect, advance, extender); - tex_add_charinfo_horizontal_part(co, h); - lua_pop(L, 1); - } else { - lua_pop(L, 1); - break; - } - } - } - lua_pop(L, 1); - lua_push_key(vparts); - if (lua_rawget(L, -2) == LUA_TTABLE) { - set_charinfo_tag(co, extension_tag); - tex_set_charinfo_vertical_parts(co, NULL); - for (lua_Integer k = 1; ; k++) { - if (lua_rawgeti(L, -1, k) == LUA_TTABLE) { - int glyph, startconnect, endconnect, advance, extender; - extinfo *h; - set_numeric_field_by_index(glyph, glyph, 0); - set_numeric_field_by_index(extender, extender, 0); - set_numeric_field_by_index(startconnect, start, 0); - set_numeric_field_by_index(endconnect, end, 0); - set_numeric_field_by_index(advance, advance, 0); - h = tex_new_charinfo_part(glyph, startconnect, endconnect, advance, extender); - tex_add_charinfo_vertical_part(co, h); + tex_append_charinfo_extensible_recipe(co, glyph, startconnect, endconnect, advance, extender); lua_pop(L, 1); } else { lua_pop(L, 1); break; } } + lua_pop(L, 1); + set_numeric_field_by_index(target, partsitalic, 0); + set_charinfo_extensible_italic(co, target); + set_string_field_by_index(starget, partsorientation); + if (lua_key_eq(starget, horizontal)) { + set_charinfo_tag(co, horizontal_tag); + } else if (lua_key_eq(starget, vertical)) { + set_charinfo_tag(co, vertical_tag); + } + } else { + lua_pop(L, 1); } - lua_pop(L, 1); lua_push_key(mathkerns); if (lua_rawget(L, -2) == LUA_TTABLE) { fontlib_aux_store_math_kerns(L, lua_key_index(topleft), co, top_left_kern); @@ -399,6 +377,7 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int kerninfo *ckerns = lmt_memory_calloc((size_t) count + 1, sizeof(kerninfo)); if (ckerns) { int ctr = 0; + set_charinfo_tag(co, kerns_tag); /*tex Traverse the hash. */ lua_pushnil(L); while (lua_next(L, -2)) { @@ -454,6 +433,7 @@ static void fontlib_aux_font_char_from_lua(lua_State *L, halfword f, int i, int ligatureinfo *cligs = lmt_memory_calloc((size_t) count + 1, sizeof(ligatureinfo)); if (cligs) { int ctr = 0; + set_charinfo_tag(co, ligatures_tag); /*tex Traverse the hash. */ lua_pushnil(L); while (lua_next(L, -2)) { @@ -702,7 +682,7 @@ static int lmt_characters_from_lua(lua_State *L, int f) int i = lmt_tointeger(L, -2); if (i >= 0 && lua_istable(L, -1)) { todo++; - if (! quick_char_exists(f, i)) { + if (! tex_char_exists(f, i)) { num++; if (i > ec) { ec = i; @@ -728,13 +708,12 @@ static int lmt_characters_from_lua(lua_State *L, int f) if (lua_type(L, -2) == LUA_TNUMBER) { int i = lmt_tointeger(L, -2); if (i >= 0) { - if (quick_char_exists(f, i)) { + if (tex_char_exists(f, i)) { charinfo *co = tex_get_charinfo(f, i); set_charinfo_ligatures(co, NULL); set_charinfo_kerns(co, NULL); set_charinfo_math(co, NULL); - tex_set_charinfo_vertical_parts(co, NULL); - tex_set_charinfo_horizontal_parts(co, NULL); + tex_set_charinfo_extensible_recipe(co, NULL); } fontlib_aux_font_char_from_lua(L, f, i, ! no_math); } diff --git a/source/luametatex/source/lua/lmtinterface.h b/source/luametatex/source/lua/lmtinterface.h index e761252a8..707d3aefb 100644 --- a/source/luametatex/source/lua/lmtinterface.h +++ b/source/luametatex/source/lua/lmtinterface.h @@ -392,33 +392,29 @@ make_lua_key(L, above);\ make_lua_key(L, abovedisplayshortskip);\ make_lua_key(L, abovedisplayskip);\ make_lua_key(L, accent);\ -make_lua_key(L, AccentBaseHeight);\ +make_lua_key(L, accentbasedepth);\ make_lua_key(L, AccentBaseDepth);\ make_lua_key(L, accentbaseheight);\ -make_lua_key(L, accentbasedepth);\ -make_lua_key(L, AccentTopShiftUp);\ -make_lua_key(L, accenttopshiftup);\ -make_lua_key(L, AccentTopOvershoot);\ -make_lua_key(L, accenttopovershoot);\ -make_lua_key(L, adapted);\ -make_lua_key(L, FlattenedAccentTopShiftUp);\ -make_lua_key(L, flattenedaccenttopshiftup);\ -make_lua_key(L, AccentBottomShiftDown);\ -make_lua_key(L, accentbottomshiftdown);\ -make_lua_key(L, AccentBottomOvershoot);\ +make_lua_key(L, AccentBaseHeight);\ make_lua_key(L, accentbottomovershoot);\ -make_lua_key(L, AccentSuperscriptDrop);\ -make_lua_key(L, accentsuperscriptdrop);\ -make_lua_key(L, AccentSuperscriptPercent);\ -make_lua_key(L, accentsuperscriptpercent);\ -make_lua_key(L, AccentExtendMargin);\ +make_lua_key(L, AccentBottomOvershoot);\ +make_lua_key(L, accentbottomshiftdown);\ +make_lua_key(L, AccentBottomShiftDown);\ make_lua_key(L, accentextendmargin);\ -make_lua_key(L, FlattenedAccentBottomShiftDown);\ -make_lua_key(L, flattenedaccentbottomshiftdown);\ +make_lua_key(L, AccentExtendMargin);\ make_lua_key(L, accentkern);\ +make_lua_key(L, accentsuperscriptdrop);\ +make_lua_key(L, AccentSuperscriptDrop);\ +make_lua_key(L, accentsuperscriptpercent);\ +make_lua_key(L, AccentSuperscriptPercent);\ +make_lua_key(L, accenttopovershoot);\ +make_lua_key(L, AccentTopOvershoot);\ +make_lua_key(L, accenttopshiftup);\ +make_lua_key(L, AccentTopShiftUp);\ make_lua_key(L, accentvariant);\ make_lua_key(L, active);\ make_lua_key(L, active_char);\ +make_lua_key(L, adapted);\ make_lua_key(L, adapttoleftsize);\ make_lua_key(L, adapttorightsize);\ make_lua_key(L, additional);\ @@ -437,12 +433,12 @@ make_lua_key(L, afterdisplaypenalty);\ make_lua_key(L, afteroutput);\ make_lua_key(L, aliased);\ make_lua_key(L, align);\ -make_lua_key(L, alignrecord);\ -make_lua_key(L, alignstack);\ make_lua_key(L, alignhead);\ make_lua_key(L, alignment);\ make_lua_key(L, alignment_tab);\ +make_lua_key(L, alignrecord);\ make_lua_key(L, alignset);\ +make_lua_key(L, alignstack);\ make_lua_key(L, alsosimple);\ make_lua_key(L, anchor);\ make_lua_key(L, argument);\ @@ -483,16 +479,16 @@ make_lua_key(L, binpunctspacing);\ make_lua_key(L, binradspacing);\ make_lua_key(L, binrelspacing);\ make_lua_key(L, boolean);\ -make_lua_key(L, bottomaccent);\ -make_lua_key(L, bottomanchor);\ -make_lua_key(L, bottomaccentvariant);\ make_lua_key(L, bothflexible);\ make_lua_key(L, bottom);\ +make_lua_key(L, bottomaccent);\ +make_lua_key(L, bottomaccentvariant);\ +make_lua_key(L, bottomanchor);\ make_lua_key(L, bottomleft);\ make_lua_key(L, bottomlevel);\ make_lua_key(L, bottommargin);\ -make_lua_key(L, bottomright);\ make_lua_key(L, bottomovershoot);\ +make_lua_key(L, bottomright);\ make_lua_key(L, boundary);\ make_lua_key(L, box);\ make_lua_key(L, broken);\ @@ -504,8 +500,8 @@ make_lua_key(L, callback);\ make_lua_key(L, cancel);\ make_lua_key(L, cardinal);\ make_lua_key(L, case_shift);\ -make_lua_key(L, catalog);\ make_lua_key(L, Catalog);\ +make_lua_key(L, catalog);\ make_lua_key(L, catcode_table);\ make_lua_key(L, category);\ make_lua_key(L, cell);\ @@ -539,6 +535,7 @@ make_lua_key(L, command);\ make_lua_key(L, comment);\ make_lua_key(L, compactmath);\ make_lua_key(L, compound);\ +make_lua_key(L, compression);\ make_lua_key(L, condition);\ make_lua_key(L, conditional);\ make_lua_key(L, conditionalmathskip);\ @@ -567,16 +564,16 @@ make_lua_key(L, define_font);\ make_lua_key(L, define_lua_call);\ make_lua_key(L, degree);\ make_lua_key(L, degreevariant);\ +make_lua_key(L, delimited);\ make_lua_key(L, DelimitedSubFormulaMinHeight);\ make_lua_key(L, delimiter);\ -make_lua_key(L, delimited);\ make_lua_key(L, delimiter_number);\ -make_lua_key(L, delimiterpercent);\ -make_lua_key(L, DelimiterPercent);\ -make_lua_key(L, delimitershortfall);\ -make_lua_key(L, DelimiterShortfall);\ make_lua_key(L, delimiterover);\ make_lua_key(L, delimiterovervariant);\ +make_lua_key(L, DelimiterPercent);\ +make_lua_key(L, delimiterpercent);\ +make_lua_key(L, DelimiterShortfall);\ +make_lua_key(L, delimitershortfall);\ make_lua_key(L, delimiterunder);\ make_lua_key(L, delimiterundervariant);\ make_lua_key(L, delta);\ @@ -657,11 +654,15 @@ make_lua_key(L, fixedboth);\ make_lua_key(L, fixedbottom);\ make_lua_key(L, fixedtop);\ make_lua_key(L, flags);\ -make_lua_key(L, FlattenedAccentBaseHeight);\ -make_lua_key(L, flattenedaccentbaseheight);\ -make_lua_key(L, FlattenedAccentBaseDepth);\ -make_lua_key(L, flattenedaccentbasedepth);\ make_lua_key(L, flataccent);\ +make_lua_key(L, flattenedaccentbasedepth);\ +make_lua_key(L, FlattenedAccentBaseDepth);\ +make_lua_key(L, flattenedaccentbaseheight);\ +make_lua_key(L, FlattenedAccentBaseHeight);\ +make_lua_key(L, flattenedaccentbottomshiftdown);\ +make_lua_key(L, FlattenedAccentBottomShiftDown);\ +make_lua_key(L, flattenedaccenttopshiftup);\ +make_lua_key(L, FlattenedAccentTopShiftUp);\ make_lua_key(L, float);\ make_lua_key(L, followedbyspace);\ make_lua_key(L, font);\ @@ -735,15 +736,14 @@ make_lua_key(L, horizontalmathkern);\ make_lua_key(L, hrule);\ make_lua_key(L, hsize);\ make_lua_key(L, hskip);\ -make_lua_key(L, hparts);\ make_lua_key(L, hyphenate);\ make_lua_key(L, hyphenated);\ make_lua_key(L, hyphenation);\ make_lua_key(L, hyphenationmode);\ make_lua_key(L, hyphenchar);\ make_lua_key(L, id);\ -make_lua_key(L, ifstack);\ make_lua_key(L, if_test);\ +make_lua_key(L, ifstack);\ make_lua_key(L, ignore);\ make_lua_key(L, ignore_something);\ make_lua_key(L, ignorebounds);\ @@ -754,13 +754,14 @@ make_lua_key(L, immutable);\ make_lua_key(L, indent);\ make_lua_key(L, indentskip);\ make_lua_key(L, index);\ -make_lua_key(L, Info);\ make_lua_key(L, info);\ +make_lua_key(L, Info);\ make_lua_key(L, inner);\ make_lua_key(L, innerbinspacing);\ make_lua_key(L, innerclosespacing);\ make_lua_key(L, innerfracspacing);\ make_lua_key(L, innerinnerspacing);\ +make_lua_key(L, innerlocation);\ make_lua_key(L, innermiddlespacing);\ make_lua_key(L, inneropenspacing);\ make_lua_key(L, inneropspacing);\ @@ -768,6 +769,8 @@ make_lua_key(L, innerordspacing);\ make_lua_key(L, innerpunctspacing);\ make_lua_key(L, innerradspacing);\ make_lua_key(L, innerrelspacing);\ +make_lua_key(L, innerxoffset);\ +make_lua_key(L, inneryoffset);\ make_lua_key(L, input);\ make_lua_key(L, insert);\ make_lua_key(L, insertheights);\ @@ -791,8 +794,8 @@ make_lua_key(L, internal_mu_glue_reference);\ make_lua_key(L, internal_toks);\ make_lua_key(L, internal_toks_reference);\ make_lua_key(L, internaldimension);\ -make_lua_key(L, internalinteger);\ make_lua_key(L, internalgluespec);\ +make_lua_key(L, internalinteger);\ make_lua_key(L, internalmugluespec);\ make_lua_key(L, invalid_char);\ make_lua_key(L, italic);\ @@ -801,7 +804,6 @@ make_lua_key(L, italiccorrection);\ make_lua_key(L, iterator_value);\ make_lua_key(L, kern);\ make_lua_key(L, kerns);\ -make_lua_key(L, noadstate);\ make_lua_key(L, language);\ make_lua_key(L, largechar);\ make_lua_key(L, largefamily);\ @@ -863,7 +865,6 @@ make_lua_key(L, make_box);\ make_lua_key(L, mark);\ make_lua_key(L, match);\ make_lua_key(L, math);\ -make_lua_key(L, mathspec);\ make_lua_key(L, math_accent);\ make_lua_key(L, math_char_number);\ make_lua_key(L, math_choice);\ @@ -876,7 +877,6 @@ make_lua_key(L, math_script);\ make_lua_key(L, math_shift);\ make_lua_key(L, math_shift_cs);\ make_lua_key(L, math_style);\ -make_lua_key(L, mathtextchar);\ make_lua_key(L, mathchar);\ make_lua_key(L, mathchoice);\ make_lua_key(L, mathcomponent);\ @@ -885,20 +885,22 @@ make_lua_key(L, mathcontrol);\ make_lua_key(L, mathdir);\ make_lua_key(L, mathfence);\ make_lua_key(L, mathfraction);\ -make_lua_key(L, mathradical);\ make_lua_key(L, mathkerns);\ make_lua_key(L, MathLeading);\ make_lua_key(L, mathoperator);\ make_lua_key(L, mathpack);\ make_lua_key(L, mathpostpenalty);\ make_lua_key(L, mathprepenalty);\ +make_lua_key(L, mathradical);\ make_lua_key(L, mathshapekern);\ make_lua_key(L, mathshift);\ make_lua_key(L, mathsimple);\ make_lua_key(L, mathskip);\ +make_lua_key(L, mathspec);\ make_lua_key(L, mathstack);\ -make_lua_key(L, mathsubformula);\ make_lua_key(L, mathstyle);\ +make_lua_key(L, mathsubformula);\ +make_lua_key(L, mathtextchar);\ make_lua_key(L, medmuskip);\ make_lua_key(L, message);\ make_lua_key(L, middle);\ @@ -934,21 +936,22 @@ make_lua_key(L, nil);\ make_lua_key(L, no);\ make_lua_key(L, no_expand);\ make_lua_key(L, noad);\ +make_lua_key(L, noadstate);\ make_lua_key(L, noalign);\ make_lua_key(L, noaligned);\ make_lua_key(L, noaxis);\ make_lua_key(L, nocheck);\ -make_lua_key(L, nooverflow);\ make_lua_key(L, node);\ make_lua_key(L, nodelist);\ make_lua_key(L, noindent);\ make_lua_key(L, nolimits);\ -make_lua_key(L, nolimitsubfactor);\ make_lua_key(L, NoLimitSubFactor);\ -make_lua_key(L, nolimitsupfactor);\ +make_lua_key(L, nolimitsubfactor);\ make_lua_key(L, NoLimitSupFactor);\ +make_lua_key(L, nolimitsupfactor);\ make_lua_key(L, nomath);\ make_lua_key(L, none);\ +make_lua_key(L, nooverflow);\ make_lua_key(L, normal);\ make_lua_key(L, norule);\ make_lua_key(L, noruling);\ @@ -1024,26 +1027,29 @@ make_lua_key(L, overlayaccent);\ make_lua_key(L, overlayaccentvariant);\ make_lua_key(L, overlinevariant);\ make_lua_key(L, overloaded);\ -make_lua_key(L, page);\ make_lua_key(L, package);\ +make_lua_key(L, page);\ make_lua_key(L, pagediscardshead);\ make_lua_key(L, pagehead);\ make_lua_key(L, pageinserthead);\ -make_lua_key(L, Pages);\ make_lua_key(L, pages);\ +make_lua_key(L, Pages);\ make_lua_key(L, par);\ make_lua_key(L, parameter);\ make_lua_key(L, parameter_reference);\ make_lua_key(L, parameters);\ make_lua_key(L, parfillleftskip);\ make_lua_key(L, parfillrightskip);\ -make_lua_key(L, parinitleftskip);\ -make_lua_key(L, parinitrightskip);\ make_lua_key(L, parfillskip);\ make_lua_key(L, parindent);\ +make_lua_key(L, parinitleftskip);\ +make_lua_key(L, parinitrightskip);\ make_lua_key(L, parshape);\ make_lua_key(L, parskip);\ make_lua_key(L, passive);\ +make_lua_key(L, parts);\ +make_lua_key(L, partsitalic);\ +make_lua_key(L, partsorientation);\ make_lua_key(L, pdfe);\ make_lua_key(L, penalty);\ make_lua_key(L, permanent);\ @@ -1080,25 +1086,25 @@ make_lua_key(L, prevgraf);\ make_lua_key(L, prime);\ make_lua_key(L, PrimeBaselineDropMax);\ make_lua_key(L, primeraise);\ -make_lua_key(L, PrimeRaisePercent);\ make_lua_key(L, primeraisecomposed);\ make_lua_key(L, PrimeRaiseComposedPercent);\ +make_lua_key(L, PrimeRaisePercent);\ make_lua_key(L, primeshiftdrop);\ -make_lua_key(L, PrimeShiftUp);\ make_lua_key(L, primeshiftup);\ +make_lua_key(L, PrimeShiftUp);\ make_lua_key(L, PrimeShiftUpCramped);\ -make_lua_key(L, primespaceafter);\ make_lua_key(L, PrimeSpaceAfter);\ +make_lua_key(L, primespaceafter);\ +make_lua_key(L, primevariant);\ make_lua_key(L, primewidth);\ make_lua_key(L, PrimeWidthPercent);\ -make_lua_key(L, primevariant);\ make_lua_key(L, primitive);\ +make_lua_key(L, properties);\ +make_lua_key(L, proportional);\ make_lua_key(L, protected);\ make_lua_key(L, protected_call);\ make_lua_key(L, protrudechars);\ make_lua_key(L, protrusion);\ -make_lua_key(L, properties);\ -make_lua_key(L, proportional);\ make_lua_key(L, ptr);\ make_lua_key(L, punct);\ make_lua_key(L, punctbinspacing);\ @@ -1119,17 +1125,17 @@ make_lua_key(L, radfracspacing);\ make_lua_key(L, radical);\ make_lua_key(L, radicaldegreeafter);\ make_lua_key(L, radicaldegreebefore);\ -make_lua_key(L, radicalextensibleafter);\ -make_lua_key(L, radicalextensiblebefore);\ -make_lua_key(L, RadicalKernAfterExtensible);\ -make_lua_key(L, RadicalKernBeforeExtensible);\ make_lua_key(L, RadicalDegreeBottomRaisePercent);\ make_lua_key(L, radicaldegreeraise);\ make_lua_key(L, RadicalDisplayStyleVerticalGap);\ +make_lua_key(L, radicalextensibleafter);\ +make_lua_key(L, radicalextensiblebefore);\ make_lua_key(L, RadicalExtraAscender);\ make_lua_key(L, radicalkern);\ make_lua_key(L, RadicalKernAfterDegree);\ +make_lua_key(L, RadicalKernAfterExtensible);\ make_lua_key(L, RadicalKernBeforeDegree);\ +make_lua_key(L, RadicalKernBeforeExtensible);\ make_lua_key(L, radicalrule);\ make_lua_key(L, RadicalRuleThickness);\ make_lua_key(L, radicalvariant);\ @@ -1160,8 +1166,8 @@ make_lua_key(L, register_mu_glue_reference);\ make_lua_key(L, register_toks);\ make_lua_key(L, register_toks_reference);\ make_lua_key(L, registerdimension);\ -make_lua_key(L, registerinteger);\ make_lua_key(L, registergluespec);\ +make_lua_key(L, registerinteger);\ make_lua_key(L, registermugluespec);\ make_lua_key(L, regular);\ make_lua_key(L, rel);\ @@ -1227,18 +1233,18 @@ make_lua_key(L, set_specification);\ make_lua_key(L, shapingpenaltiesmode);\ make_lua_key(L, shapingpenalty);\ make_lua_key(L, shift);\ -make_lua_key(L, shiftedsubscript);\ -make_lua_key(L, shiftedsuperscript);\ make_lua_key(L, shiftedsubprescript);\ +make_lua_key(L, shiftedsubscript);\ make_lua_key(L, shiftedsuperprescript);\ +make_lua_key(L, shiftedsuperscript);\ make_lua_key(L, shorthand_def);\ make_lua_key(L, shrink);\ make_lua_key(L, shrinkorder);\ make_lua_key(L, simple);\ make_lua_key(L, size);\ make_lua_key(L, skewchar);\ -make_lua_key(L, skeweddelimitertolerance);\ make_lua_key(L, SkewedDelimiterTolerance);\ +make_lua_key(L, skeweddelimitertolerance);\ make_lua_key(L, skewedfractionhgap);\ make_lua_key(L, SkewedFractionHorizontalGap);\ make_lua_key(L, SkewedFractionVerticalGap);\ @@ -1252,10 +1258,10 @@ make_lua_key(L, smallfamily);\ make_lua_key(L, some_item);\ make_lua_key(L, source);\ make_lua_key(L, space);\ -make_lua_key(L, SpaceAfterScript);\ make_lua_key(L, spaceafterscript);\ -make_lua_key(L, spacebeforescript);\ +make_lua_key(L, SpaceAfterScript);\ make_lua_key(L, SpaceBeforeScript);\ +make_lua_key(L, spacebeforescript);\ make_lua_key(L, spacefactor);\ make_lua_key(L, spacer);\ make_lua_key(L, spaceshrink);\ @@ -1333,6 +1339,7 @@ make_lua_key(L, supshiftup);\ make_lua_key(L, supsubbottommax);\ make_lua_key(L, surround);\ make_lua_key(L, syllable);\ +make_lua_key(L, tag);\ make_lua_key(L, tabskip);\ make_lua_key(L, tail);\ make_lua_key(L, target);\ @@ -1357,17 +1364,17 @@ make_lua_key(L, tolerant_call);\ make_lua_key(L, tolerant_protected_call);\ make_lua_key(L, top);\ make_lua_key(L, topaccent);\ -make_lua_key(L, topanchor);\ make_lua_key(L, topaccentvariant);\ +make_lua_key(L, topanchor);\ make_lua_key(L, topleft);\ make_lua_key(L, topmargin);\ +make_lua_key(L, topovershoot);\ make_lua_key(L, topright);\ make_lua_key(L, topskip);\ -make_lua_key(L, topovershoot);\ make_lua_key(L, total);\ make_lua_key(L, tracingparagraphs);\ -make_lua_key(L, trailer);\ make_lua_key(L, Trailer);\ +make_lua_key(L, trailer);\ make_lua_key(L, type);\ make_lua_key(L, uchyph);\ make_lua_key(L, uleaders);\ @@ -1413,7 +1420,6 @@ make_lua_key(L, vertical);\ make_lua_key(L, verticalmathkern);\ make_lua_key(L, vextensible);\ make_lua_key(L, vextensiblevariant);\ -make_lua_key(L, vitalic);\ make_lua_key(L, vlist);\ make_lua_key(L, vmode);\ make_lua_key(L, vmodepar);\ @@ -1422,7 +1428,6 @@ make_lua_key(L, void);\ make_lua_key(L, vrule);\ make_lua_key(L, vskip);\ make_lua_key(L, vtop);\ -make_lua_key(L, vparts);\ make_lua_key(L, whatsit);\ make_lua_key(L, widowpenalties);\ make_lua_key(L, widowpenalty);\ @@ -1605,7 +1610,6 @@ extern lmt_keys_info lmt_keys; # define lmt_rounded(d) (lua_Integer) (llround(d)) # define lmt_roundedfloat(f) (lua_Integer) (llround((double) f)) - # define lmt_tolong(L,i) (long) lua_tointeger(L,i) # define lmt_checklong(L,i) (long) luaL_checkinteger(L,i) # define lmt_optlong(L,i,j) (long) luaL_optinteger(L,i,j) diff --git a/source/luametatex/source/lua/lmtlibrary.c b/source/luametatex/source/lua/lmtlibrary.c index ff6822a02..cb51273b5 100644 --- a/source/luametatex/source/lua/lmtlibrary.c +++ b/source/luametatex/source/lua/lmtlibrary.c @@ -71,7 +71,7 @@ int lmt_library_okay(lmt_library lib) /* experiment */ -int librarylib_load(lua_State *L) +static int librarylib_load(lua_State *L) { /* So we permit it in mtxrun (for now, when we test). */ if (lmt_engine_state.lua_only || lmt_engine_state.permit_loadlib) { diff --git a/source/luametatex/source/lua/lmtlibrary.h b/source/luametatex/source/lua/lmtlibrary.h index 40f5f47f4..8367d66ea 100644 --- a/source/luametatex/source/lua/lmtlibrary.h +++ b/source/luametatex/source/lua/lmtlibrary.h @@ -18,7 +18,7 @@ /* void : dlclose(lib) | string: dlerror() */ -typedef void (*lmt_library_function); +typedef void *lmt_library_function; # ifdef _WIN32 diff --git a/source/luametatex/source/lua/lmtluaclib.c b/source/luametatex/source/lua/lmtluaclib.c index 797585aba..bf8888add 100644 --- a/source/luametatex/source/lua/lmtluaclib.c +++ b/source/luametatex/source/lua/lmtluaclib.c @@ -31,7 +31,7 @@ static TString **tmname = NULL; -# define toproto(L,i) getproto(s2v(L->top+(i))) +# define toproto(L,i) getproto(s2v(L->top.p+(i))) # define UPVALNAME(x) ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-") # define LUACVOID(p) ((const void*)(p)) # define eventname(i) (getstr(tmname[i])) diff --git a/source/luametatex/source/lua/lmtmplib.c b/source/luametatex/source/lua/lmtmplib.c index 74d684c3f..ecbfd46b6 100644 --- a/source/luametatex/source/lua/lmtmplib.c +++ b/source/luametatex/source/lua/lmtmplib.c @@ -765,7 +765,7 @@ static char *mplib_aux_run_script(MP mp, const char *str, size_t len, int n) return NULL; } -void mplib_aux_run_internal(MP mp, int action, int n, int type, const char *name) +static void mplib_aux_run_internal(MP mp, int action, int n, int type, const char *name) { if (mp->run_internal_id) { lua_State *L = (lua_State *) mp_userdata(mp); @@ -2754,13 +2754,6 @@ static int mplib_getcallbackstate(lua_State *L) This assumes that the top of the stack is a table or nil already in the case. */ -# define mplib_set_color_objects(pq) \ -object_color_model = pq->color_model; \ -object_color_a = pq->color.a_val; \ -object_color_b = pq->color.b_val; \ -object_color_c = pq->color.c_val; \ -object_color_d = pq->color.d_val; - static void mplib_aux_push_color(lua_State *L, struct mp_graphic_object *p) { if (p) { @@ -2771,11 +2764,19 @@ static void mplib_aux_push_color(lua_State *L, struct mp_graphic_object *p) case mp_stroked_code: { mp_shape_object *h = (mp_shape_object *) p; - mplib_set_color_objects(h); + object_color_model = h->color_model; + object_color_a = h->color.a_val; + object_color_b = h->color.b_val; + object_color_c = h->color.c_val; + object_color_d = h->color.d_val; } break; default: object_color_model = mp_no_model; + object_color_a = 0.0; + object_color_b = 0.0; + object_color_c = 0.0; + object_color_d = 0.0; break; } switch (object_color_model) { diff --git a/source/luametatex/source/lua/lmtnodelib.c b/source/luametatex/source/lua/lmtnodelib.c index eb29611e2..caa9da065 100644 --- a/source/luametatex/source/lua/lmtnodelib.c +++ b/source/luametatex/source/lua/lmtnodelib.c @@ -231,7 +231,7 @@ static void nodelib_push_attribute_data(lua_State* L, halfword n) inline static singleword nodelib_getdirection(lua_State *L, int i) { - return ((lua_type(L, i) == LUA_TNUMBER) ? checked_direction_value(lmt_tohalfword(L, i)) : direction_def_value); + return ((lua_type(L, i) == LUA_TNUMBER) ? (singleword) checked_direction_value(lmt_tohalfword(L, i)) : direction_def_value); } /*tex @@ -1892,7 +1892,7 @@ static int nodelib_direct_getdisc(lua_State *L) if (lua_isboolean(L, 2) && lua_toboolean(L, 2)) { nodelib_push_direct_or_nil(L, tex_tail_of_node_list(choice_pre_break(n))); nodelib_push_direct_or_nil(L, tex_tail_of_node_list(choice_post_break(n))); - nodelib_push_direct_or_nil(L, tex_tail_of_node_list(choice_post_break(n))); + nodelib_push_direct_or_nil(L, tex_tail_of_node_list(choice_no_break(n))); return 6; } else { return 3; @@ -4504,7 +4504,7 @@ static int nodelib_direct_dimensions(lua_State *L) { int top = lua_gettop(L); if (top > 0) { - scaledwhd siz = { 0, 0, 0 }; + scaledwhd siz = { 0, 0, 0, 0 }; glueratio g_mult = normal_glue_multiplier; int vertical = 0; int g_sign = normal_glue_sign; @@ -4545,7 +4545,7 @@ static int nodelib_direct_rangedimensions(lua_State *L) /* parent, first, last * { int top = lua_gettop(L); if (top > 1) { - scaledwhd siz = { 0, 0, 0 }; + scaledwhd siz = { 0, 0, 0, 0 }; int vertical = 0; halfword l = nodelib_valid_direct_from_index(L, 1); /* parent */ halfword n = nodelib_valid_direct_from_index(L, 2); /* first */ @@ -5379,8 +5379,8 @@ static int nodelib_direct_setglue(lua_State *L) case vlist_node: case unset_node: box_glue_set(n) = ((top > 1 && lua_type(L, 2) == LUA_TNUMBER)) ? (glueratio) lua_tonumber(L, 2) : 0; - box_glue_order(n) = tex_checked_glue_sign((top > 2 && lua_type(L, 3) == LUA_TNUMBER) ? (halfword) lua_tointeger(L, 3) : 0); - box_glue_sign(n) = tex_checked_glue_order((top > 3 && lua_type(L, 4) == LUA_TNUMBER) ? (halfword) lua_tointeger(L, 4) : 0); + box_glue_order(n) = tex_checked_glue_order((top > 2 && lua_type(L, 3) == LUA_TNUMBER) ? (halfword) lua_tointeger(L, 3) : 0); + box_glue_sign(n) = tex_checked_glue_sign((top > 3 && lua_type(L, 4) == LUA_TNUMBER) ? (halfword) lua_tointeger(L, 4) : 0); break; case math_node: math_amount(n) = ((top > 1 && lua_type(L, 2) == LUA_TNUMBER)) ? (halfword) lmt_roundnumber(L, 2) : 0; @@ -7117,9 +7117,9 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) } else if (lua_key_eq(s, shrink)) { glue_shrink(n) = (halfword) lmt_roundnumber(L, 3); } else if (lua_key_eq(s, stretchorder)) { - glue_stretch_order(n) = lmt_tohalfword(L, 3); + glue_stretch_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else if (lua_key_eq(s, shrinkorder)) { - glue_shrink_order(n) = lmt_tohalfword(L, 3); + glue_shrink_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else if (lua_key_eq(s, leader)) { glue_leader_ptr(n) = nodelib_direct_or_node_from_index(L, direct, 3); } else if (lua_key_eq(s, font)) { @@ -7265,9 +7265,9 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) } else if (lua_key_eq(s, shrink)) { math_shrink(n) = (halfword) lmt_roundnumber(L, 3); } else if (lua_key_eq(s, stretchorder)) { - math_stretch_order(n) = lmt_tohalfword(L, 3); + math_stretch_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else if (lua_key_eq(s, shrinkorder)) { - math_shrink_order(n) = lmt_tohalfword(L, 3); + math_shrink_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else if (lua_key_eq(s, penalty)) { math_penalty(n) = lmt_tohalfword(L, 3); } else { @@ -7320,7 +7320,7 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) } else if (lua_key_eq(s, options)) { noad_options(n) = lmt_tohalfword(L, 3); } else if (lua_key_eq(s, scriptorder)) { - noad_script_order(n) = lmt_tohalfword(L, 3); + noad_script_order(n) = lmt_tosingleword(L, 3); } else if (lua_key_eq(s, class)) { halfword c = lmt_tohalfword(L, 3); set_noad_main_class(n, c); @@ -7469,7 +7469,7 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) /* just ignored */ return 0; } - break; + // break; case adjust_node: if (lua_key_eq(s, list) || lua_key_eq(s, head)) { adjust_list(n) = nodelib_direct_or_node_from_index(L, direct, 3); @@ -7522,9 +7522,9 @@ static int nodelib_common_setfield(lua_State *L, int direct, halfword n) } else if (lua_key_eq(s, shrink)) { glue_shrink(n) = (halfword) lmt_roundnumber(L, 3); } else if (lua_key_eq(s, stretchorder)) { - glue_stretch_order(n) = lmt_tohalfword(L, 3); + glue_stretch_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else if (lua_key_eq(s, shrinkorder)) { - glue_shrink_order(n) = lmt_tohalfword(L, 3); + glue_shrink_order(n) = tex_checked_glue_order(lmt_tohalfword(L, 3)); } else { goto CANTSET; } @@ -9093,8 +9093,9 @@ static halfword lmt_direct_migrate_locate(halfword head, halfword *first, halfwo case insert_node: { if (inserts) { + halfword list; head = nodelib_aux_migrate_decouple(head, current, next, first, last); - halfword list = insert_list(current); + list = insert_list(current); if (list) { insert_list(current) = lmt_direct_migrate_locate(list, first, last, inserts, marks); } @@ -9196,7 +9197,7 @@ static int nodelib_direct_hasglyphoption(lua_State *L) halfword current = nodelib_valid_direct_from_index(L, 1); int result = 0; if (current && node_type(current) == glyph_node) { - int option = lua_tointeger(L, 2); + int option = lmt_tointeger(L, 2); switch (option) { case glyph_option_normal_glyph: // 0x00 break; @@ -9332,9 +9333,9 @@ static int nodelib_direct_getnodes(lua_State *L) /* maybe count */ lua_newtable(L); if (lua_type(L, 2) == LUA_TNUMBER) { - int t = lua_tonumber(L, 2); + int t = lmt_tointeger(L, 2); if (lua_type(L, 3) == LUA_TNUMBER) { - int s = lua_tonumber(L, 3); + int s = lmt_tointeger(L, 3); while (n) { if (node_type(n) == t && node_subtype(n) == s) { lua_pushinteger(L, n); diff --git a/source/luametatex/source/lua/lmttexlib.c b/source/luametatex/source/lua/lmttexlib.c index afafb068b..c88d13490 100644 --- a/source/luametatex/source/lua/lmttexlib.c +++ b/source/luametatex/source/lua/lmttexlib.c @@ -1402,9 +1402,9 @@ static halfword texlib_aux_make_glue(lua_State *L, int top, int slot) if (slot <= top) { glue_shrink(value) = lmt_toroundnumber(L, slot++); if (slot <= top) { - glue_stretch_order(value) = lmt_tohalfword(L, slot++); + glue_stretch_order(value) = tex_checked_glue_order(lmt_tohalfword(L, slot++)); if (slot <= top) { - glue_shrink_order(value) = lmt_tohalfword(L, slot++); + glue_shrink_order(value) = tex_checked_glue_order(lmt_tohalfword(L, slot++)); } } } @@ -2466,9 +2466,9 @@ static int texlib_set_item(lua_State* L, int index, int prefixes) if (slot <= top) { glue_shrink(value) = lmt_toroundnumber(L, slot++); if (slot <= top) { - glue_stretch_order(value) = lmt_tohalfword(L, slot++); + glue_stretch_order(value) = tex_checked_glue_order(lmt_tohalfword(L, slot++)); if (slot <= top) { - glue_shrink_order(value) = lmt_tohalfword(L, slot); + glue_shrink_order(value) = tex_checked_glue_order(lmt_tohalfword(L, slot)); } } } @@ -2877,8 +2877,8 @@ static int texlib_setmath(lua_State *L) glue_amount(p) = lmt_optroundnumber(L, slot++, 0); glue_stretch(p) = lmt_optroundnumber(L, slot++, 0); glue_shrink(p) = lmt_optroundnumber(L, slot++, 0); - glue_stretch_order(p) = lmt_optroundnumber(L, slot++, 0); - glue_shrink_order(p) = lmt_optroundnumber(L, slot, 0); + glue_stretch_order(p) = tex_checked_glue_order(lmt_optroundnumber(L, slot++, 0)); + glue_shrink_order(p) = tex_checked_glue_order(lmt_optroundnumber(L, slot, 0)); tex_def_math_parameter(style, param, (scaled) p, level, indirect_math_regular); break; } @@ -4385,7 +4385,7 @@ static int texlib_setboxdir(lua_State *L) { int index = lmt_tointeger(L, 1); if (index >= 0 && index <= max_box_register_index) { - tex_set_box_dir(index, lmt_tointeger(L, 2)); + tex_set_box_dir(index, lmt_tosingleword(L, 2)); } else { texlib_aux_show_box_index_error(L); } @@ -4536,8 +4536,8 @@ static int texlib_mathchardef(lua_State *L) if (tex_define_permitted(cs, flags)) { mathcodeval m; mathdictval d; - m.class_value = lmt_tointeger(L, 2); - m.family_value = lmt_tointeger(L, 3); + m.class_value = (short) lmt_tointeger(L, 2); + m.family_value = (short) lmt_tointeger(L, 3); m.character_value = lmt_tointeger(L, 4); d.properties = lmt_optquarterword(L, 6, 0); d.group = lmt_optquarterword(L, 7, 0); @@ -5002,6 +5002,27 @@ static int texlib_getkerneloptionvalues(lua_State *L) return 1; } +static int texlib_getcharactertagvalues(lua_State *L) +{ + lua_createtable(L, 2, 12); + lua_set_string_by_index(L, no_tag, "normal"); + lua_set_string_by_index(L, ligatures_tag, "ligatures"); + lua_set_string_by_index(L, kerns_tag, "kerns"); + lua_set_string_by_index(L, list_tag, "list"); + lua_set_string_by_index(L, callback_tag, "callback"); + lua_set_string_by_index(L, extensible_tag, "extensible"); + lua_set_string_by_index(L, horizontal_tag, "horizontal"); + lua_set_string_by_index(L, vertical_tag, "vertical"); + lua_set_string_by_index(L, extend_last_tag, "extendlast"); + lua_set_string_by_index(L, inner_left_tag, "innerleft"); + lua_set_string_by_index(L, inner_right_tag, "innerright"); + lua_set_string_by_index(L, italic_tag, "italic"); + lua_set_string_by_index(L, n_ary_tag, "nary"); + lua_set_string_by_index(L, radical_tag, "radical"); + lua_set_string_by_index(L, punctuation_tag, "punctuation"); + return 1; +} + static int texlib_getshapingpenaltiesvalues(lua_State *L) { lua_createtable(L, 2, 2); @@ -5139,7 +5160,7 @@ static int texlib_getdiscstatevalues(lua_State *L) static int texlib_getmathcontrolvalues(lua_State *L) { - lua_createtable(L, 2, 21); + lua_createtable(L, 2, 23); lua_set_string_by_index(L, math_control_use_font_control, "usefontcontrol"); lua_set_string_by_index(L, math_control_over_rule, "overrule"); lua_set_string_by_index(L, math_control_under_rule, "underrule"); @@ -5163,6 +5184,8 @@ static int texlib_getmathcontrolvalues(lua_State *L) lua_set_string_by_index(L, math_control_analyze_script_nucleus_box, "analyzescriptnucleusbox"); lua_set_string_by_index(L, math_control_accent_top_skew_with_offset, "accenttopskewwithoffset"); lua_set_string_by_index(L, math_control_ignore_kern_dimensions, "ignorekerndimensions"); + lua_set_string_by_index(L, math_control_ignore_flat_accents, "ignoreflataccents"); + lua_set_string_by_index(L, math_control_extend_accents, "extendaccents"); return 1; } @@ -5462,6 +5485,7 @@ static const struct luaL_Reg texlib_function_list[] = { { "getprimitiveorigins", texlib_getprimitiveorigins }, { "getfrozenparvalues", texlib_getfrozenparvalues }, { "getshapingpenaltiesvalues", texlib_getshapingpenaltiesvalues }, + { "getcharactertagvalues", texlib_getcharactertagvalues }, { "getkerneloptionvalues", texlib_getkerneloptionvalues }, { "getspecialmathclassvalues", texlib_getspecialmathclassvalues }, { "getlargestusedmark", texlib_getlargestusedmark }, diff --git a/source/luametatex/source/lua/lmttokenlib.c b/source/luametatex/source/lua/lmttokenlib.c index feac7cd46..e15b2de5a 100644 --- a/source/luametatex/source/lua/lmttokenlib.c +++ b/source/luametatex/source/lua/lmttokenlib.c @@ -347,23 +347,16 @@ inline static int tokenlib_aux_to_valid_index(int cmd, int chr) case internal_command_item: case reference_command_item: case data_command_item: - { - halfword c = chr; - switch (item.base) { - case ignore_entry: - return 0; - case direct_entry: - break; - default: - chr -= item.base; - break; - } - if (c >= item.min && c <= item.max) { - return c; - } else { - return item.min; - } + switch (item.base) { + case ignore_entry: + return 0; + case direct_entry: + break; + default: + chr -= item.base; + break; } + return (chr >= item.min && chr <= item.max) ? chr : item.min; case token_command_item: case node_command_item: return item.fixedvalue; @@ -2147,7 +2140,7 @@ static int tokenlib_future_expand(lua_State *L) return 0; } } - return 0; + // return 0; } static int tokenlib_scan_code(lua_State *L) @@ -2735,8 +2728,9 @@ static int tokenlib_get_fields(lua_State *L) size_t l; const char *str = lua_tolstring(L, 1, &l); if (l > 0) { + halfword cs; lua_createtable(L, 0, onlyflags ? 0 : 5); - halfword cs = tex_string_locate(str, l, 0); + cs = tex_string_locate(str, l, 0); cmd = eq_type(cs); chr = eq_value(cs); flags = eq_flag(cs); @@ -3174,10 +3168,11 @@ static int tokenlib_set_lua(lua_State *L) size_t lname = 0; const char *name = lua_tolstring(L, 1, &lname); if (name) { + halfword cs; int flags = 0; int funct = lmt_tointeger(L, 2); /*tex todo: check range */ lmt_check_for_flags(L, 3, &flags, 1, 1); - halfword cs = tex_string_locate(name, lname, 1); + cs = tex_string_locate(name, lname, 1); if (tex_define_permitted(cs, flags)) { if (is_value(flags)) { tex_define(flags, cs, lua_value_cmd, funct); diff --git a/source/luametatex/source/luacore/lua54/src/Makefile b/source/luametatex/source/luacore/lua54/src/Makefile index d46e650cb..ee56c6720 100644 --- a/source/luametatex/source/luacore/lua54/src/Makefile +++ b/source/luametatex/source/luacore/lua54/src/Makefile @@ -57,8 +57,13 @@ CWARNS= $(CWARNSCPP) $(CWARNSC) $(CWARNGCC) # -pg -malign-double # -DLUA_USE_CTYPE -DLUA_USE_APICHECK -# ('-ftrapv' for runtime checks of integer overflows) -# -fsanitize=undefined -ftrapv -fno-inline + +# The following options help detect "undefined behavior"s that seldom +# create problems; some are only available in newer gcc versions. To +# use some of them, we also have to define an enrivonment variable +# ASAN_OPTIONS="detect_invalid_pointer_pairs=2". +# -fsanitize=undefined +# -fsanitize=pointer-subtract -fsanitize=address -fsanitize=pointer-compare # TESTS= -DLUA_USER_H='"ltests.h"' -O0 -g diff --git a/source/luametatex/source/luacore/lua54/src/lapi.c b/source/luametatex/source/luacore/lua54/src/lapi.c index 5833c7b0a..34e64af14 100644 --- a/source/luametatex/source/luacore/lua54/src/lapi.c +++ b/source/luametatex/source/luacore/lua54/src/lapi.c @@ -60,27 +60,28 @@ const char lua_ident[] = static TValue *index2value (lua_State *L, int idx) { CallInfo *ci = L->ci; if (idx > 0) { - StkId o = ci->func + idx; - api_check(L, idx <= L->ci->top - (ci->func + 1), "unacceptable index"); - if (o >= L->top) return &G(L)->nilvalue; + StkId o = ci->func.p + idx; + api_check(L, idx <= ci->top.p - (ci->func.p + 1), "unacceptable index"); + if (o >= L->top.p) return &G(L)->nilvalue; else return s2v(o); } else if (!ispseudo(idx)) { /* negative index */ - api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index"); - return s2v(L->top + idx); + api_check(L, idx != 0 && -idx <= L->top.p - (ci->func.p + 1), + "invalid index"); + return s2v(L->top.p + idx); } else if (idx == LUA_REGISTRYINDEX) return &G(L)->l_registry; else { /* upvalues */ idx = LUA_REGISTRYINDEX - idx; api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); - if (ttisCclosure(s2v(ci->func))) { /* C closure? */ - CClosure *func = clCvalue(s2v(ci->func)); + if (ttisCclosure(s2v(ci->func.p))) { /* C closure? */ + CClosure *func = clCvalue(s2v(ci->func.p)); return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : &G(L)->nilvalue; } else { /* light C function or Lua function (through a hook)?) */ - api_check(L, ttislcf(s2v(ci->func)), "caller not a C function"); + api_check(L, ttislcf(s2v(ci->func.p)), "caller not a C function"); return &G(L)->nilvalue; /* no upvalues */ } } @@ -94,14 +95,15 @@ static TValue *index2value (lua_State *L, int idx) { l_sinline StkId index2stack (lua_State *L, int idx) { CallInfo *ci = L->ci; if (idx > 0) { - StkId o = ci->func + idx; - api_check(L, o < L->top, "invalid index"); + StkId o = ci->func.p + idx; + api_check(L, o < L->top.p, "invalid index"); return o; } else { /* non-positive index */ - api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index"); + api_check(L, idx != 0 && -idx <= L->top.p - (ci->func.p + 1), + "invalid index"); api_check(L, !ispseudo(idx), "invalid index"); - return L->top + idx; + return L->top.p + idx; } } @@ -112,12 +114,12 @@ LUA_API int lua_checkstack (lua_State *L, int n) { lua_lock(L); ci = L->ci; api_check(L, n >= 0, "negative 'n'"); - if (L->stack_last - L->top > n) /* stack large enough? */ + if (L->stack_last.p - L->top.p > n) /* stack large enough? */ res = 1; /* yes; check is OK */ else /* need to grow stack */ res = luaD_growstack(L, n, 0); - if (res && ci->top < L->top + n) - ci->top = L->top + n; /* adjust frame top */ + if (res && ci->top.p < L->top.p + n) + ci->top.p = L->top.p + n; /* adjust frame top */ lua_unlock(L); return res; } @@ -129,11 +131,11 @@ LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { lua_lock(to); api_checknelems(from, n); api_check(from, G(from) == G(to), "moving among independent states"); - api_check(from, to->ci->top - to->top >= n, "stack overflow"); - from->top -= n; + api_check(from, to->ci->top.p - to->top.p >= n, "stack overflow"); + from->top.p -= n; for (i = 0; i < n; i++) { - setobjs2s(to, to->top, from->top + i); - to->top++; /* stack already checked by previous 'api_check' */ + setobjs2s(to, to->top.p, from->top.p + i); + to->top.p++; /* stack already checked by previous 'api_check' */ } lua_unlock(to); } @@ -167,12 +169,12 @@ LUA_API lua_Number lua_version (lua_State *L) { LUA_API int lua_absindex (lua_State *L, int idx) { return (idx > 0 || ispseudo(idx)) ? idx - : cast_int(L->top - L->ci->func) + idx; + : cast_int(L->top.p - L->ci->func.p) + idx; } LUA_API int lua_gettop (lua_State *L) { - return cast_int(L->top - (L->ci->func + 1)); + return cast_int(L->top.p - (L->ci->func.p + 1)); } @@ -182,24 +184,24 @@ LUA_API void lua_settop (lua_State *L, int idx) { ptrdiff_t diff; /* difference for new top */ lua_lock(L); ci = L->ci; - func = ci->func; + func = ci->func.p; if (idx >= 0) { - api_check(L, idx <= ci->top - (func + 1), "new top too large"); - diff = ((func + 1) + idx) - L->top; + api_check(L, idx <= ci->top.p - (func + 1), "new top too large"); + diff = ((func + 1) + idx) - L->top.p; for (; diff > 0; diff--) - setnilvalue(s2v(L->top++)); /* clear new slots */ + setnilvalue(s2v(L->top.p++)); /* clear new slots */ } else { - api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top"); + api_check(L, -(idx+1) <= (L->top.p - (func + 1)), "invalid new top"); diff = idx + 1; /* will "subtract" index (as it is negative) */ } - api_check(L, L->tbclist < L->top, "previous pop of an unclosed slot"); - newtop = L->top + diff; - if (diff < 0 && L->tbclist >= newtop) { + api_check(L, L->tbclist.p < L->top.p, "previous pop of an unclosed slot"); + newtop = L->top.p + diff; + if (diff < 0 && L->tbclist.p >= newtop) { lua_assert(hastocloseCfunc(ci->nresults)); newtop = luaF_close(L, newtop, CLOSEKTOP, 0); } - L->top = newtop; /* correct top only after closing any upvalue */ + L->top.p = newtop; /* correct top only after closing any upvalue */ lua_unlock(L); } @@ -208,7 +210,7 @@ LUA_API void lua_closeslot (lua_State *L, int idx) { StkId level; lua_lock(L); level = index2stack(L, idx); - api_check(L, hastocloseCfunc(L->ci->nresults) && L->tbclist == level, + api_check(L, hastocloseCfunc(L->ci->nresults) && L->tbclist.p == level, "no variable to close at given level"); level = luaF_close(L, level, CLOSEKTOP, 0); setnilvalue(s2v(level)); @@ -239,7 +241,7 @@ l_sinline void reverse (lua_State *L, StkId from, StkId to) { LUA_API void lua_rotate (lua_State *L, int idx, int n) { StkId p, t, m; lua_lock(L); - t = L->top - 1; /* end of stack segment being rotated */ + t = L->top.p - 1; /* end of stack segment being rotated */ p = index2stack(L, idx); /* start of segment */ api_check(L, (n >= 0 ? n : -n) <= (t - p + 1), "invalid 'n'"); m = (n >= 0 ? t - n : p - n - 1); /* end of prefix */ @@ -258,7 +260,7 @@ LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { api_check(L, isvalid(L, to), "invalid index"); setobj(L, to, fr); if (isupvalue(toidx)) /* function upvalue? */ - luaC_barrier(L, clCvalue(s2v(L->ci->func)), fr); + luaC_barrier(L, clCvalue(s2v(L->ci->func.p)), fr); /* LUA_REGISTRYINDEX does not need gc barrier (collector revisits it before finishing collection) */ lua_unlock(L); @@ -267,7 +269,7 @@ LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { LUA_API void lua_pushvalue (lua_State *L, int idx) { lua_lock(L); - setobj2s(L, L->top, index2value(L, idx)); + setobj2s(L, L->top.p, index2value(L, idx)); api_incr_top(L); lua_unlock(L); } @@ -336,12 +338,12 @@ LUA_API void lua_arith (lua_State *L, int op) { api_checknelems(L, 2); /* all other operations expect two operands */ else { /* for unary operations, add fake 2nd operand */ api_checknelems(L, 1); - setobjs2s(L, L->top, L->top - 1); + setobjs2s(L, L->top.p, L->top.p - 1); api_incr_top(L); } /* first operand at top - 2, second at top - 1; result go to top - 2 */ - luaO_arith(L, op, s2v(L->top - 2), s2v(L->top - 1), L->top - 2); - L->top--; /* remove second operand */ + luaO_arith(L, op, s2v(L->top.p - 2), s2v(L->top.p - 1), L->top.p - 2); + L->top.p--; /* remove second operand */ lua_unlock(L); } @@ -367,7 +369,7 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { - size_t sz = luaO_str2num(s, s2v(L->top)); + size_t sz = luaO_str2num(s, s2v(L->top.p)); if (sz != 0) api_incr_top(L); return sz; @@ -494,7 +496,7 @@ LUA_API const void *lua_topointer (lua_State *L, int idx) { LUA_API void lua_pushnil (lua_State *L) { lua_lock(L); - setnilvalue(s2v(L->top)); + setnilvalue(s2v(L->top.p)); api_incr_top(L); lua_unlock(L); } @@ -502,7 +504,7 @@ LUA_API void lua_pushnil (lua_State *L) { LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { lua_lock(L); - setfltvalue(s2v(L->top), n); + setfltvalue(s2v(L->top.p), n); api_incr_top(L); lua_unlock(L); } @@ -510,7 +512,7 @@ LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { lua_lock(L); - setivalue(s2v(L->top), n); + setivalue(s2v(L->top.p), n); api_incr_top(L); lua_unlock(L); } @@ -525,7 +527,7 @@ LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { TString *ts; lua_lock(L); ts = (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len); - setsvalue2s(L, L->top, ts); + setsvalue2s(L, L->top.p, ts); api_incr_top(L); luaC_checkGC(L); lua_unlock(L); @@ -536,11 +538,11 @@ LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { LUA_API const char *lua_pushstring (lua_State *L, const char *s) { lua_lock(L); if (s == NULL) - setnilvalue(s2v(L->top)); + setnilvalue(s2v(L->top.p)); else { TString *ts; ts = luaS_new(L, s); - setsvalue2s(L, L->top, ts); + setsvalue2s(L, L->top.p, ts); s = getstr(ts); /* internal copy's address */ } api_incr_top(L); @@ -577,7 +579,7 @@ LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { lua_lock(L); if (n == 0) { - setfvalue(s2v(L->top), fn); + setfvalue(s2v(L->top.p), fn); api_incr_top(L); } else { @@ -586,13 +588,13 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { api_check(L, n <= MAXUPVAL, "upvalue index too large"); cl = luaF_newCclosure(L, n); cl->f = fn; - L->top -= n; + L->top.p -= n; while (n--) { - setobj2n(L, &cl->upvalue[n], s2v(L->top + n)); + setobj2n(L, &cl->upvalue[n], s2v(L->top.p + n)); /* does not need barrier because closure is white */ lua_assert(iswhite(cl)); } - setclCvalue(L, s2v(L->top), cl); + setclCvalue(L, s2v(L->top.p), cl); api_incr_top(L); luaC_checkGC(L); } @@ -603,9 +605,9 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { LUA_API void lua_pushboolean (lua_State *L, int b) { lua_lock(L); if (b) - setbtvalue(s2v(L->top)); + setbtvalue(s2v(L->top.p)); else - setbfvalue(s2v(L->top)); + setbfvalue(s2v(L->top.p)); api_incr_top(L); lua_unlock(L); } @@ -613,7 +615,7 @@ LUA_API void lua_pushboolean (lua_State *L, int b) { LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { lua_lock(L); - setpvalue(s2v(L->top), p); + setpvalue(s2v(L->top.p), p); api_incr_top(L); lua_unlock(L); } @@ -621,7 +623,7 @@ LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { LUA_API int lua_pushthread (lua_State *L) { lua_lock(L); - setthvalue(L, s2v(L->top), L); + setthvalue(L, s2v(L->top.p), L); api_incr_top(L); lua_unlock(L); return (G(L)->mainthread == L); @@ -638,16 +640,16 @@ l_sinline int auxgetstr (lua_State *L, const TValue *t, const char *k) { const TValue *slot; TString *str = luaS_new(L, k); if (luaV_fastget(L, t, str, slot, luaH_getstr)) { - setobj2s(L, L->top, slot); + setobj2s(L, L->top.p, slot); api_incr_top(L); } else { - setsvalue2s(L, L->top, str); + setsvalue2s(L, L->top.p, str); api_incr_top(L); - luaV_finishget(L, t, s2v(L->top - 1), L->top - 1, slot); + luaV_finishget(L, t, s2v(L->top.p - 1), L->top.p - 1, slot); } lua_unlock(L); - return ttype(s2v(L->top - 1)); + return ttype(s2v(L->top.p - 1)); } @@ -674,13 +676,13 @@ LUA_API int lua_gettable (lua_State *L, int idx) { TValue *t; lua_lock(L); t = index2value(L, idx); - if (luaV_fastget(L, t, s2v(L->top - 1), slot, luaH_get)) { - setobj2s(L, L->top - 1, slot); + if (luaV_fastget(L, t, s2v(L->top.p - 1), slot, luaH_get)) { + setobj2s(L, L->top.p - 1, slot); } else - luaV_finishget(L, t, s2v(L->top - 1), L->top - 1, slot); + luaV_finishget(L, t, s2v(L->top.p - 1), L->top.p - 1, slot); lua_unlock(L); - return ttype(s2v(L->top - 1)); + return ttype(s2v(L->top.p - 1)); } @@ -696,27 +698,27 @@ LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { lua_lock(L); t = index2value(L, idx); if (luaV_fastgeti(L, t, n, slot)) { - setobj2s(L, L->top, slot); + setobj2s(L, L->top.p, slot); } else { TValue aux; setivalue(&aux, n); - luaV_finishget(L, t, &aux, L->top, slot); + luaV_finishget(L, t, &aux, L->top.p, slot); } api_incr_top(L); lua_unlock(L); - return ttype(s2v(L->top - 1)); + return ttype(s2v(L->top.p - 1)); } l_sinline int finishrawget (lua_State *L, const TValue *val) { if (isempty(val)) /* avoid copying empty items to the stack */ - setnilvalue(s2v(L->top)); + setnilvalue(s2v(L->top.p)); else - setobj2s(L, L->top, val); + setobj2s(L, L->top.p, val); api_incr_top(L); lua_unlock(L); - return ttype(s2v(L->top - 1)); + return ttype(s2v(L->top.p - 1)); } @@ -733,8 +735,8 @@ LUA_API int lua_rawget (lua_State *L, int idx) { lua_lock(L); api_checknelems(L, 1); t = gettable(L, idx); - val = luaH_get(t, s2v(L->top - 1)); - L->top--; /* remove key */ + val = luaH_get(t, s2v(L->top.p - 1)); + L->top.p--; /* remove key */ return finishrawget(L, val); } @@ -761,7 +763,7 @@ LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { Table *t; lua_lock(L); t = luaH_new(L); - sethvalue2s(L, L->top, t); + sethvalue2s(L, L->top.p, t); api_incr_top(L); if (narray > 0 || nrec > 0) luaH_resize(L, t, narray, nrec); @@ -788,7 +790,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { break; } if (mt != NULL) { - sethvalue2s(L, L->top, mt); + sethvalue2s(L, L->top.p, mt); api_incr_top(L); res = 1; } @@ -804,12 +806,12 @@ LUA_API int lua_getiuservalue (lua_State *L, int idx, int n) { o = index2value(L, idx); api_check(L, ttisfulluserdata(o), "full userdata expected"); if (n <= 0 || n > uvalue(o)->nuvalue) { - setnilvalue(s2v(L->top)); + setnilvalue(s2v(L->top.p)); t = LUA_TNONE; } else { - setobj2s(L, L->top, &uvalue(o)->uv[n - 1].uv); - t = ttype(s2v(L->top)); + setobj2s(L, L->top.p, &uvalue(o)->uv[n - 1].uv); + t = ttype(s2v(L->top.p)); } api_incr_top(L); lua_unlock(L); @@ -829,14 +831,14 @@ static void auxsetstr (lua_State *L, const TValue *t, const char *k) { TString *str = luaS_new(L, k); api_checknelems(L, 1); if (luaV_fastget(L, t, str, slot, luaH_getstr)) { - luaV_finishfastset(L, t, slot, s2v(L->top - 1)); - L->top--; /* pop value */ + luaV_finishfastset(L, t, slot, s2v(L->top.p - 1)); + L->top.p--; /* pop value */ } else { - setsvalue2s(L, L->top, str); /* push 'str' (to make it a TValue) */ + setsvalue2s(L, L->top.p, str); /* push 'str' (to make it a TValue) */ api_incr_top(L); - luaV_finishset(L, t, s2v(L->top - 1), s2v(L->top - 2), slot); - L->top -= 2; /* pop value and key */ + luaV_finishset(L, t, s2v(L->top.p - 1), s2v(L->top.p - 2), slot); + L->top.p -= 2; /* pop value and key */ } lua_unlock(L); /* lock done by caller */ } @@ -856,12 +858,12 @@ LUA_API void lua_settable (lua_State *L, int idx) { lua_lock(L); api_checknelems(L, 2); t = index2value(L, idx); - if (luaV_fastget(L, t, s2v(L->top - 2), slot, luaH_get)) { - luaV_finishfastset(L, t, slot, s2v(L->top - 1)); + if (luaV_fastget(L, t, s2v(L->top.p - 2), slot, luaH_get)) { + luaV_finishfastset(L, t, slot, s2v(L->top.p - 1)); } else - luaV_finishset(L, t, s2v(L->top - 2), s2v(L->top - 1), slot); - L->top -= 2; /* pop index and value */ + luaV_finishset(L, t, s2v(L->top.p - 2), s2v(L->top.p - 1), slot); + L->top.p -= 2; /* pop index and value */ lua_unlock(L); } @@ -879,14 +881,14 @@ LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) { api_checknelems(L, 1); t = index2value(L, idx); if (luaV_fastgeti(L, t, n, slot)) { - luaV_finishfastset(L, t, slot, s2v(L->top - 1)); + luaV_finishfastset(L, t, slot, s2v(L->top.p - 1)); } else { TValue aux; setivalue(&aux, n); - luaV_finishset(L, t, &aux, s2v(L->top - 1), slot); + luaV_finishset(L, t, &aux, s2v(L->top.p - 1), slot); } - L->top--; /* pop value */ + L->top.p--; /* pop value */ lua_unlock(L); } @@ -896,16 +898,16 @@ static void aux_rawset (lua_State *L, int idx, TValue *key, int n) { lua_lock(L); api_checknelems(L, n); t = gettable(L, idx); - luaH_set(L, t, key, s2v(L->top - 1)); + luaH_set(L, t, key, s2v(L->top.p - 1)); invalidateTMcache(t); - luaC_barrierback(L, obj2gco(t), s2v(L->top - 1)); - L->top -= n; + luaC_barrierback(L, obj2gco(t), s2v(L->top.p - 1)); + L->top.p -= n; lua_unlock(L); } LUA_API void lua_rawset (lua_State *L, int idx) { - aux_rawset(L, idx, s2v(L->top - 2), 2); + aux_rawset(L, idx, s2v(L->top.p - 2), 2); } @@ -921,9 +923,9 @@ LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n) { lua_lock(L); api_checknelems(L, 1); t = gettable(L, idx); - luaH_setint(L, t, n, s2v(L->top - 1)); - luaC_barrierback(L, obj2gco(t), s2v(L->top - 1)); - L->top--; + luaH_setint(L, t, n, s2v(L->top.p - 1)); + luaC_barrierback(L, obj2gco(t), s2v(L->top.p - 1)); + L->top.p--; lua_unlock(L); } @@ -934,11 +936,11 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) { lua_lock(L); api_checknelems(L, 1); obj = index2value(L, objindex); - if (ttisnil(s2v(L->top - 1))) + if (ttisnil(s2v(L->top.p - 1))) mt = NULL; else { - api_check(L, ttistable(s2v(L->top - 1)), "table expected"); - mt = hvalue(s2v(L->top - 1)); + api_check(L, ttistable(s2v(L->top.p - 1)), "table expected"); + mt = hvalue(s2v(L->top.p - 1)); } switch (ttype(obj)) { case LUA_TTABLE: { @@ -962,7 +964,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) { break; } } - L->top--; + L->top.p--; lua_unlock(L); return 1; } @@ -978,11 +980,11 @@ LUA_API int lua_setiuservalue (lua_State *L, int idx, int n) { if (!(cast_uint(n) - 1u < cast_uint(uvalue(o)->nuvalue))) res = 0; /* 'n' not in [1, uvalue(o)->nuvalue] */ else { - setobj(L, &uvalue(o)->uv[n - 1].uv, s2v(L->top - 1)); - luaC_barrierback(L, gcvalue(o), s2v(L->top - 1)); + setobj(L, &uvalue(o)->uv[n - 1].uv, s2v(L->top.p - 1)); + luaC_barrierback(L, gcvalue(o), s2v(L->top.p - 1)); res = 1; } - L->top--; + L->top.p--; lua_unlock(L); return res; } @@ -994,7 +996,8 @@ LUA_API int lua_setiuservalue (lua_State *L, int idx, int n) { #define checkresults(L,na,nr) \ - api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \ + api_check(L, (nr) == LUA_MULTRET \ + || (L->ci->top.p - L->top.p >= (nr) - (na)), \ "results from function overflow current stack size") @@ -1007,7 +1010,7 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults, api_checknelems(L, nargs+1); api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); checkresults(L, nargs, nresults); - func = L->top - (nargs+1); + func = L->top.p - (nargs+1); if (k != NULL && yieldable(L)) { /* need to prepare continuation? */ L->ci->u.c.k = k; /* save continuation */ L->ci->u.c.ctx = ctx; /* save context */ @@ -1055,7 +1058,7 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, api_check(L, ttisfunction(s2v(o)), "error handler must be a function"); func = savestack(L, o); } - c.func = L->top - (nargs+1); /* function to be called */ + c.func = L->top.p - (nargs+1); /* function to be called */ if (k == NULL || !yieldable(L)) { /* no continuation or no yieldable? */ c.nresults = nresults; /* do a 'conventional' protected call */ status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); @@ -1090,12 +1093,12 @@ LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, luaZ_init(L, &z, reader, data); status = luaD_protectedparser(L, &z, chunkname, mode); if (status == LUA_OK) { /* no errors? */ - LClosure *f = clLvalue(s2v(L->top - 1)); /* get newly created function */ + LClosure *f = clLvalue(s2v(L->top.p - 1)); /* get new function */ if (f->nupvalues >= 1) { /* does it have an upvalue? */ /* get global table from registry */ const TValue *gt = getGtable(L); /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */ - setobj(L, f->upvals[0]->v, gt); + setobj(L, f->upvals[0]->v.p, gt); luaC_barrier(L, f->upvals[0], gt); } } @@ -1109,7 +1112,7 @@ LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) { TValue *o; lua_lock(L); api_checknelems(L, 1); - o = s2v(L->top - 1); + o = s2v(L->top.p - 1); if (isLfunction(o)) status = luaU_dump(L, getproto(o), writer, data, strip); else @@ -1235,7 +1238,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { LUA_API int lua_error (lua_State *L) { TValue *errobj; lua_lock(L); - errobj = s2v(L->top - 1); + errobj = s2v(L->top.p - 1); api_checknelems(L, 1); /* error object is the memory error message? */ if (ttisshrstring(errobj) && eqshrstr(tsvalue(errobj), G(L)->memerrmsg)) @@ -1253,12 +1256,12 @@ LUA_API int lua_next (lua_State *L, int idx) { lua_lock(L); api_checknelems(L, 1); t = gettable(L, idx); - more = luaH_next(L, t, L->top - 1); + more = luaH_next(L, t, L->top.p - 1); if (more) { api_incr_top(L); } else /* no more elements */ - L->top -= 1; /* remove key */ + L->top.p -= 1; /* remove key */ lua_unlock(L); return more; } @@ -1270,7 +1273,7 @@ LUA_API void lua_toclose (lua_State *L, int idx) { lua_lock(L); o = index2stack(L, idx); nresults = L->ci->nresults; - api_check(L, L->tbclist < o, "given index below or equal a marked one"); + api_check(L, L->tbclist.p < o, "given index below or equal a marked one"); luaF_newtbcupval(L, o); /* create new to-be-closed upvalue */ if (!hastocloseCfunc(nresults)) /* function not marked yet? */ L->ci->nresults = codeNresults(nresults); /* mark it */ @@ -1285,7 +1288,7 @@ LUA_API void lua_concat (lua_State *L, int n) { if (n > 0) luaV_concat(L, n); else { /* nothing to concatenate */ - setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); /* push empty string */ + setsvalue2s(L, L->top.p, luaS_newlstr(L, "", 0)); /* push empty string */ api_incr_top(L); } luaC_checkGC(L); @@ -1297,7 +1300,7 @@ LUA_API void lua_len (lua_State *L, int idx) { TValue *t; lua_lock(L); t = index2value(L, idx); - luaV_objlen(L, L->top, t); + luaV_objlen(L, L->top.p, t); api_incr_top(L); lua_unlock(L); } @@ -1342,7 +1345,7 @@ LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) { lua_lock(L); api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value"); u = luaS_newudata(L, size, nuvalue); - setuvalue(L, s2v(L->top), u); + setuvalue(L, s2v(L->top.p), u); api_incr_top(L); luaC_checkGC(L); lua_unlock(L); @@ -1368,7 +1371,7 @@ static const char *aux_upvalue (TValue *fi, int n, TValue **val, Proto *p = f->p; if (!(cast_uint(n) - 1u < cast_uint(p->sizeupvalues))) return NULL; /* 'n' not in [1, p->sizeupvalues] */ - *val = f->upvals[n-1]->v; + *val = f->upvals[n-1]->v.p; if (owner) *owner = obj2gco(f->upvals[n - 1]); name = p->upvalues[n-1].name; return (name == NULL) ? "(no name)" : getstr(name); @@ -1384,7 +1387,7 @@ LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { lua_lock(L); name = aux_upvalue(index2value(L, funcindex), n, &val, NULL); if (name) { - setobj2s(L, L->top, val); + setobj2s(L, L->top.p, val); api_incr_top(L); } lua_unlock(L); @@ -1402,8 +1405,8 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { api_checknelems(L, 1); name = aux_upvalue(fi, n, &val, &owner); if (name) { - L->top--; - setobj(L, val, s2v(L->top)); + L->top.p--; + setobj(L, val, s2v(L->top.p)); luaC_barrier(L, owner, val); } lua_unlock(L); diff --git a/source/luametatex/source/luacore/lua54/src/lapi.h b/source/luametatex/source/luacore/lua54/src/lapi.h index 9e99cc448..a742427cd 100644 --- a/source/luametatex/source/luacore/lua54/src/lapi.h +++ b/source/luametatex/source/luacore/lua54/src/lapi.h @@ -12,23 +12,26 @@ #include "lstate.h" -/* Increments 'L->top', checking for stack overflows */ -#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ - "stack overflow");} +/* Increments 'L->top.p', checking for stack overflows */ +#define api_incr_top(L) {L->top.p++; \ + api_check(L, L->top.p <= L->ci->top.p, \ + "stack overflow");} /* ** If a call returns too many multiple returns, the callee may not have ** stack space to accommodate all results. In this case, this macro -** increases its stack space ('L->ci->top'). +** increases its stack space ('L->ci->top.p'). */ #define adjustresults(L,nres) \ - { if ((nres) <= LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } + { if ((nres) <= LUA_MULTRET && L->ci->top.p < L->top.p) \ + L->ci->top.p = L->top.p; } /* Ensure the stack has at least 'n' elements */ -#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ - "not enough elements in the stack") +#define api_checknelems(L,n) \ + api_check(L, (n) < (L->top.p - L->ci->func.p), \ + "not enough elements in the stack") /* diff --git a/source/luametatex/source/luacore/lua54/src/lcorolib.c b/source/luametatex/source/luacore/lua54/src/lcorolib.c index 785a1e81a..40b880b14 100644 --- a/source/luametatex/source/luacore/lua54/src/lcorolib.c +++ b/source/luametatex/source/luacore/lua54/src/lcorolib.c @@ -76,7 +76,7 @@ static int luaB_auxwrap (lua_State *L) { if (l_unlikely(r < 0)) { /* error? */ int stat = lua_status(co); if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ - stat = lua_resetthread(co); /* close its tbc variables */ + stat = lua_resetthread(co, L); /* close its tbc variables */ lua_assert(stat != LUA_OK); lua_xmove(co, L, 1); /* move error message to the caller */ } @@ -172,7 +172,7 @@ static int luaB_close (lua_State *L) { int status = auxstatus(L, co); switch (status) { case COS_DEAD: case COS_YIELD: { - status = lua_resetthread(co); + status = lua_resetthread(co, L); if (status == LUA_OK) { lua_pushboolean(L, 1); return 1; diff --git a/source/luametatex/source/luacore/lua54/src/ldebug.c b/source/luametatex/source/luacore/lua54/src/ldebug.c index fa15eaf68..3fae5cf25 100644 --- a/source/luametatex/source/luacore/lua54/src/ldebug.c +++ b/source/luametatex/source/luacore/lua54/src/ldebug.c @@ -182,10 +182,10 @@ static const char *upvalname (const Proto *p, int uv) { static const char *findvararg (CallInfo *ci, int n, StkId *pos) { - if (clLvalue(s2v(ci->func))->p->is_vararg) { + if (clLvalue(s2v(ci->func.p))->p->is_vararg) { int nextra = ci->u.l.nextraargs; if (n >= -nextra) { /* 'n' is negative */ - *pos = ci->func - nextra - (n + 1); + *pos = ci->func.p - nextra - (n + 1); return "(vararg)"; /* generic name for any vararg */ } } @@ -194,7 +194,7 @@ static const char *findvararg (CallInfo *ci, int n, StkId *pos) { const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n, StkId *pos) { - StkId base = ci->func + 1; + StkId base = ci->func.p + 1; const char *name = NULL; if (isLua(ci)) { if (n < 0) /* access to vararg values? */ @@ -203,7 +203,7 @@ const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n, StkId *pos) { name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); } if (name == NULL) { /* no 'standard' name? */ - StkId limit = (ci == L->ci) ? L->top : ci->next->func; + StkId limit = (ci == L->ci) ? L->top.p : ci->next->func.p; if (limit - base >= n && n > 0) { /* is 'n' inside 'ci' stack? */ /* generic name for any valid slot */ name = isLua(ci) ? "(temporary)" : "(C temporary)"; @@ -221,16 +221,16 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { const char *name; lua_lock(L); if (ar == NULL) { /* information about non-active function? */ - if (!isLfunction(s2v(L->top - 1))) /* not a Lua function? */ + if (!isLfunction(s2v(L->top.p - 1))) /* not a Lua function? */ name = NULL; else /* consider live variables at function start (parameters) */ - name = luaF_getlocalname(clLvalue(s2v(L->top - 1))->p, n, 0); + name = luaF_getlocalname(clLvalue(s2v(L->top.p - 1))->p, n, 0); } else { /* active function; get information through 'ar' */ StkId pos = NULL; /* to avoid warnings */ name = luaG_findlocal(L, ar->i_ci, n, &pos); if (name) { - setobjs2s(L, L->top, pos); + setobjs2s(L, L->top.p, pos); api_incr_top(L); } } @@ -245,8 +245,8 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { lua_lock(L); name = luaG_findlocal(L, ar->i_ci, n, &pos); if (name) { - setobjs2s(L, pos, L->top - 1); - L->top--; /* pop value */ + setobjs2s(L, pos, L->top.p - 1); + L->top.p--; /* pop value */ } lua_unlock(L); return name; @@ -289,7 +289,7 @@ static int nextline (const Proto *p, int currentline, int pc) { static void collectvalidlines (lua_State *L, Closure *f) { if (noLuaClosure(f)) { - setnilvalue(s2v(L->top)); + setnilvalue(s2v(L->top.p)); api_incr_top(L); } else { @@ -298,7 +298,7 @@ static void collectvalidlines (lua_State *L, Closure *f) { const Proto *p = f->l.p; int currentline = p->linedefined; Table *t = luaH_new(L); /* new table to store active lines */ - sethvalue2s(L, L->top, t); /* push it on stack */ + sethvalue2s(L, L->top.p, t); /* push it on stack */ api_incr_top(L); setbtvalue(&v); /* boolean 'true' to be the value of all indices */ if (!p->is_vararg) /* regular function? */ @@ -388,20 +388,20 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { lua_lock(L); if (*what == '>') { ci = NULL; - func = s2v(L->top - 1); + func = s2v(L->top.p - 1); api_check(L, ttisfunction(func), "function expected"); what++; /* skip the '>' */ - L->top--; /* pop function */ + L->top.p--; /* pop function */ } else { ci = ar->i_ci; - func = s2v(ci->func); + func = s2v(ci->func.p); lua_assert(ttisfunction(func)); } cl = ttisclosure(func) ? clvalue(func) : NULL; status = auxgetinfo(L, what, ar, cl, ci); if (strchr(what, 'f')) { - setobj2s(L, L->top, func); + setobj2s(L, L->top.p, func); api_incr_top(L); } if (strchr(what, 'L')) @@ -663,7 +663,7 @@ static const char *funcnamefromcall (lua_State *L, CallInfo *ci, */ static int isinstack (CallInfo *ci, const TValue *o) { StkId pos; - for (pos = ci->func + 1; pos < ci->top; pos++) { + for (pos = ci->func.p + 1; pos < ci->top.p; pos++) { if (o == s2v(pos)) return 1; } @@ -681,7 +681,7 @@ static const char *getupvalname (CallInfo *ci, const TValue *o, LClosure *c = ci_func(ci); int i; for (i = 0; i < c->nupvalues; i++) { - if (c->upvals[i]->v == o) { + if (c->upvals[i]->v.p == o) { *name = upvalname(c->p, i); return "upvalue"; } @@ -710,7 +710,7 @@ static const char *varinfo (lua_State *L, const TValue *o) { kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ if (!kind && isinstack(ci, o)) /* no? try a register */ kind = getobjname(ci_func(ci)->p, currentpc(ci), - cast_int(cast(StkId, o) - (ci->func + 1)), &name); + cast_int(cast(StkId, o) - (ci->func.p + 1)), &name); } return formatvarinfo(L, kind, name); } @@ -807,10 +807,10 @@ l_noret luaG_errormsg (lua_State *L) { if (L->errfunc != 0) { /* is there an error handling function? */ StkId errfunc = restorestack(L, L->errfunc); lua_assert(ttisfunction(s2v(errfunc))); - setobjs2s(L, L->top, L->top - 1); /* move argument */ - setobjs2s(L, L->top - 1, errfunc); /* push function */ - L->top++; /* assume EXTRA_STACK */ - luaD_callnoyield(L, L->top - 2, 1); /* call it */ + setobjs2s(L, L->top.p, L->top.p - 1); /* move argument */ + setobjs2s(L, L->top.p - 1, errfunc); /* push function */ + L->top.p++; /* assume EXTRA_STACK */ + luaD_callnoyield(L, L->top.p - 2, 1); /* call it */ } luaD_throw(L, LUA_ERRRUN); } @@ -826,8 +826,8 @@ l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { va_end(argp); if (isLua(ci)) { /* if Lua function, add source:line information */ luaG_addinfo(L, msg, ci_func(ci)->p->source, getcurrentline(ci)); - setobjs2s(L, L->top - 2, L->top - 1); /* remove 'msg' from the stack */ - L->top--; + setobjs2s(L, L->top.p - 2, L->top.p - 1); /* remove 'msg' */ + L->top.p--; } luaG_errormsg(L); } @@ -872,7 +872,7 @@ static int changedline (const Proto *p, int oldpc, int newpc) { ** invalid; if so, use zero as a valid value. (A wrong but valid 'oldpc' ** at most causes an extra call to a line hook.) ** This function is not "Protected" when called, so it should correct -** 'L->top' before calling anything that can run the GC. +** 'L->top.p' before calling anything that can run the GC. */ int luaG_traceexec (lua_State *L, const Instruction *pc) { CallInfo *ci = L->ci; @@ -895,7 +895,7 @@ int luaG_traceexec (lua_State *L, const Instruction *pc) { return 1; /* do not call hook again (VM yielded, so it did not move) */ } if (!isIT(*(ci->u.l.savedpc - 1))) /* top not being used? */ - L->top = ci->top; /* correct top */ + L->top.p = ci->top.p; /* correct top */ if (counthook) luaD_hook(L, LUA_HOOKCOUNT, -1, 0, 0); /* call count hook */ if (mask & LUA_MASKLINE) { diff --git a/source/luametatex/source/luacore/lua54/src/ldebug.h b/source/luametatex/source/luacore/lua54/src/ldebug.h index 974960e99..2c3074c61 100644 --- a/source/luametatex/source/luacore/lua54/src/ldebug.h +++ b/source/luametatex/source/luacore/lua54/src/ldebug.h @@ -15,7 +15,7 @@ /* Active Lua function (given call info) */ -#define ci_func(ci) (clLvalue(s2v((ci)->func))) +#define ci_func(ci) (clLvalue(s2v((ci)->func.p))) #define resethookcount(L) (L->hookcount = L->basehookcount) diff --git a/source/luametatex/source/luacore/lua54/src/ldo.c b/source/luametatex/source/luacore/lua54/src/ldo.c index 419b3db93..c30cde76f 100644 --- a/source/luametatex/source/luacore/lua54/src/ldo.c +++ b/source/luametatex/source/luacore/lua54/src/ldo.c @@ -104,11 +104,11 @@ void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { } default: { lua_assert(errorstatus(errcode)); /* real error */ - setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ + setobjs2s(L, oldtop, L->top.p - 1); /* error message on current top */ break; } } - L->top = oldtop + 1; + L->top.p = oldtop + 1; } @@ -121,7 +121,7 @@ l_noret luaD_throw (lua_State *L, int errcode) { global_State *g = G(L); errcode = luaE_resetthread(L, errcode); /* close all upvalues */ if (g->mainthread->errorJmp) { /* main thread has a handler? */ - setobjs2s(L, g->mainthread->top++, L->top - 1); /* copy error obj. */ + setobjs2s(L, g->mainthread->top.p++, L->top.p - 1); /* copy error obj. */ luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ } else { /* no handler at all; abort */ @@ -157,16 +157,38 @@ int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { ** Stack reallocation ** =================================================================== */ -static void correctstack (lua_State *L, StkId oldstack, StkId newstack) { + + +/* +** Change all pointers to the stack into offsets. +*/ +static void relstack (lua_State *L) { CallInfo *ci; UpVal *up; - L->top = (L->top - oldstack) + newstack; - L->tbclist = (L->tbclist - oldstack) + newstack; + L->top.offset = savestack(L, L->top.p); + L->tbclist.offset = savestack(L, L->tbclist.p); for (up = L->openupval; up != NULL; up = up->u.open.next) - up->v = s2v((uplevel(up) - oldstack) + newstack); + up->v.offset = savestack(L, uplevel(up)); for (ci = L->ci; ci != NULL; ci = ci->previous) { - ci->top = (ci->top - oldstack) + newstack; - ci->func = (ci->func - oldstack) + newstack; + ci->top.offset = savestack(L, ci->top.p); + ci->func.offset = savestack(L, ci->func.p); + } +} + + +/* +** Change back all offsets into pointers. +*/ +static void correctstack (lua_State *L) { + CallInfo *ci; + UpVal *up; + L->top.p = restorestack(L, L->top.offset); + L->tbclist.p = restorestack(L, L->tbclist.offset); + for (up = L->openupval; up != NULL; up = up->u.open.next) + up->v.p = s2v(restorestack(L, up->v.offset)); + for (ci = L->ci; ci != NULL; ci = ci->previous) { + ci->top.p = restorestack(L, ci->top.offset); + ci->func.p = restorestack(L, ci->func.offset); if (isLua(ci)) ci->u.l.trap = 1; /* signal to update 'trap' in 'luaV_execute' */ } @@ -176,38 +198,39 @@ static void correctstack (lua_State *L, StkId oldstack, StkId newstack) { /* some space for error handling */ #define ERRORSTACKSIZE (LUAI_MAXSTACK + 200) - /* -** Reallocate the stack to a new size, correcting all pointers into -** it. (There are pointers to a stack from its upvalues, from its list -** of call infos, plus a few individual pointers.) The reallocation is -** done in two steps (allocation + free) because the correction must be -** done while both addresses (the old stack and the new one) are valid. -** (In ISO C, any pointer use after the pointer has been deallocated is -** undefined behavior.) +** Reallocate the stack to a new size, correcting all pointers into it. +** In ISO C, any pointer use after the pointer has been deallocated is +** undefined behavior. So, before the reallocation, all pointers are +** changed to offsets, and after the reallocation they are changed back +** to pointers. As during the reallocation the pointers are invalid, the +** reallocation cannot run emergency collections. +** ** In case of allocation error, raise an error or return false according ** to 'raiseerror'. */ int luaD_reallocstack (lua_State *L, int newsize, int raiseerror) { int oldsize = stacksize(L); int i; - StkId newstack = luaM_reallocvector(L, NULL, 0, - newsize + EXTRA_STACK, StackValue); + StkId newstack; + int oldgcstop = G(L)->gcstopem; lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE); + relstack(L); /* change pointers to offsets */ + G(L)->gcstopem = 1; /* stop emergency collection */ + newstack = luaM_reallocvector(L, L->stack.p, oldsize + EXTRA_STACK, + newsize + EXTRA_STACK, StackValue); + G(L)->gcstopem = oldgcstop; /* restore emergency collection */ if (l_unlikely(newstack == NULL)) { /* reallocation failed? */ + correctstack(L); /* change offsets back to pointers */ if (raiseerror) luaM_error(L); else return 0; /* do not raise an error */ } - /* number of elements to be copied to the new stack */ - i = ((oldsize <= newsize) ? oldsize : newsize) + EXTRA_STACK; - memcpy(newstack, L->stack, i * sizeof(StackValue)); - for (; i < newsize + EXTRA_STACK; i++) + L->stack.p = newstack; + correctstack(L); /* change offsets back to pointers */ + L->stack_last.p = L->stack.p + newsize; + for (i = oldsize + EXTRA_STACK; i < newsize + EXTRA_STACK; i++) setnilvalue(s2v(newstack + i)); /* erase new segment */ - correctstack(L, L->stack, newstack); - luaM_freearray(L, L->stack, oldsize + EXTRA_STACK); - L->stack = newstack; - L->stack_last = L->stack + newsize; return 1; } @@ -229,7 +252,7 @@ int luaD_growstack (lua_State *L, int n, int raiseerror) { } else if (n < LUAI_MAXSTACK) { /* avoids arithmetic overflows */ int newsize = 2 * size; /* tentative new size */ - int needed = cast_int(L->top - L->stack) + n; + int needed = cast_int(L->top.p - L->stack.p) + n; if (newsize > LUAI_MAXSTACK) /* cannot cross the limit */ newsize = LUAI_MAXSTACK; if (newsize < needed) /* but must respect what was asked for */ @@ -253,12 +276,12 @@ int luaD_growstack (lua_State *L, int n, int raiseerror) { static int stackinuse (lua_State *L) { CallInfo *ci; int res; - StkId lim = L->top; + StkId lim = L->top.p; for (ci = L->ci; ci != NULL; ci = ci->previous) { - if (lim < ci->top) lim = ci->top; + if (lim < ci->top.p) lim = ci->top.p; } - lua_assert(lim <= L->stack_last + EXTRA_STACK); - res = cast_int(lim - L->stack) + 1; /* part of stack in use */ + lua_assert(lim <= L->stack_last.p + EXTRA_STACK); + res = cast_int(lim - L->stack.p) + 1; /* part of stack in use */ if (res < LUA_MINSTACK) res = LUA_MINSTACK; /* ensure a minimum size */ return res; @@ -295,7 +318,7 @@ void luaD_shrinkstack (lua_State *L) { void luaD_inctop (lua_State *L) { luaD_checkstack(L, 1); - L->top++; + L->top.p++; } /* }================================================================== */ @@ -312,8 +335,8 @@ void luaD_hook (lua_State *L, int event, int line, if (hook && L->allowhook) { /* make sure there is a hook */ int mask = CIST_HOOKED; CallInfo *ci = L->ci; - ptrdiff_t top = savestack(L, L->top); /* preserve original 'top' */ - ptrdiff_t ci_top = savestack(L, ci->top); /* idem for 'ci->top' */ + ptrdiff_t top = savestack(L, L->top.p); /* preserve original 'top' */ + ptrdiff_t ci_top = savestack(L, ci->top.p); /* idem for 'ci->top' */ lua_Debug ar; ar.event = event; ar.currentline = line; @@ -323,11 +346,11 @@ void luaD_hook (lua_State *L, int event, int line, ci->u2.transferinfo.ftransfer = ftransfer; ci->u2.transferinfo.ntransfer = ntransfer; } - if (isLua(ci) && L->top < ci->top) - L->top = ci->top; /* protect entire activation register */ + if (isLua(ci) && L->top.p < ci->top.p) + L->top.p = ci->top.p; /* protect entire activation register */ luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ - if (ci->top < L->top + LUA_MINSTACK) - ci->top = L->top + LUA_MINSTACK; + if (ci->top.p < L->top.p + LUA_MINSTACK) + ci->top.p = L->top.p + LUA_MINSTACK; L->allowhook = 0; /* cannot call hooks inside a hook */ ci->callstatus |= mask; lua_unlock(L); @@ -335,8 +358,8 @@ void luaD_hook (lua_State *L, int event, int line, lua_lock(L); lua_assert(!L->allowhook); L->allowhook = 1; - ci->top = restorestack(L, ci_top); - L->top = restorestack(L, top); + ci->top.p = restorestack(L, ci_top); + L->top.p = restorestack(L, top); ci->callstatus &= ~mask; } } @@ -367,7 +390,7 @@ void luaD_hookcall (lua_State *L, CallInfo *ci) { */ static void rethook (lua_State *L, CallInfo *ci, int nres) { if (L->hookmask & LUA_MASKRET) { /* is return hook on? */ - StkId firstres = L->top - nres; /* index of first result */ + StkId firstres = L->top.p - nres; /* index of first result */ int delta = 0; /* correction for vararg functions */ int ftransfer; if (isLua(ci)) { @@ -375,10 +398,10 @@ static void rethook (lua_State *L, CallInfo *ci, int nres) { if (p->is_vararg) delta = ci->u.l.nextraargs + p->numparams + 1; } - ci->func += delta; /* if vararg, back to virtual 'func' */ - ftransfer = cast(unsigned short, firstres - ci->func); + ci->func.p += delta; /* if vararg, back to virtual 'func' */ + ftransfer = cast(unsigned short, firstres - ci->func.p); luaD_hook(L, LUA_HOOKRET, -1, ftransfer, nres); /* call it */ - ci->func -= delta; + ci->func.p -= delta; } if (isLua(ci = ci->previous)) L->oldpc = pcRel(ci->u.l.savedpc, ci_func(ci)->p); /* set 'oldpc' */ @@ -397,9 +420,9 @@ StkId luaD_tryfuncTM (lua_State *L, StkId func) { tm = luaT_gettmbyobj(L, s2v(func), TM_CALL); /* (after previous GC) */ if (l_unlikely(ttisnil(tm))) luaG_callerror(L, s2v(func)); /* nothing to call */ - for (p = L->top; p > func; p--) /* open space for metamethod */ + for (p = L->top.p; p > func; p--) /* open space for metamethod */ setobjs2s(L, p, p-1); - L->top++; /* stack space pre-allocated by the caller */ + L->top.p++; /* stack space pre-allocated by the caller */ setobj2s(L, func, tm); /* metamethod is the new function to be called */ return func; } @@ -416,14 +439,14 @@ l_sinline void moveresults (lua_State *L, StkId res, int nres, int wanted) { int i; switch (wanted) { /* handle typical cases separately */ case 0: /* no values needed */ - L->top = res; + L->top.p = res; return; case 1: /* one value needed */ if (nres == 0) /* no results? */ setnilvalue(s2v(res)); /* adjust with nil */ else /* at least one result */ - setobjs2s(L, res, L->top - nres); /* move it to proper place */ - L->top = res + 1; + setobjs2s(L, res, L->top.p - nres); /* move it to proper place */ + L->top.p = res + 1; return; case LUA_MULTRET: wanted = nres; /* we want all results */ @@ -446,14 +469,14 @@ l_sinline void moveresults (lua_State *L, StkId res, int nres, int wanted) { break; } /* generic case */ - firstresult = L->top - nres; /* index of first result */ + firstresult = L->top.p - nres; /* index of first result */ if (nres > wanted) /* extra results? */ nres = wanted; /* don't need them */ for (i = 0; i < nres; i++) /* move all results to correct place */ setobjs2s(L, res + i, firstresult + i); for (; i < wanted; i++) /* complete wanted number of results */ setnilvalue(s2v(res + i)); - L->top = res + wanted; /* top points after the last result */ + L->top.p = res + wanted; /* top points after the last result */ } @@ -468,7 +491,7 @@ void luaD_poscall (lua_State *L, CallInfo *ci, int nres) { if (l_unlikely(L->hookmask && !hastocloseCfunc(wanted))) rethook(L, ci, nres); /* move results to proper place */ - moveresults(L, ci->func, nres, wanted); + moveresults(L, ci->func.p, nres, wanted); /* function cannot be in any of these cases when returning */ lua_assert(!(ci->callstatus & (CIST_HOOKED | CIST_YPCALL | CIST_FIN | CIST_TRAN | CIST_CLSRET))); @@ -483,10 +506,10 @@ void luaD_poscall (lua_State *L, CallInfo *ci, int nres) { l_sinline CallInfo *prepCallInfo (lua_State *L, StkId func, int nret, int mask, StkId top) { CallInfo *ci = L->ci = next_ci(L); /* new frame */ - ci->func = func; + ci->func.p = func; ci->nresults = nret; ci->callstatus = mask; - ci->top = top; + ci->top.p = top; return ci; } @@ -500,10 +523,10 @@ l_sinline int precallC (lua_State *L, StkId func, int nresults, CallInfo *ci; checkstackGCp(L, LUA_MINSTACK, func); /* ensure minimum stack size */ L->ci = ci = prepCallInfo(L, func, nresults, CIST_C, - L->top + LUA_MINSTACK); - lua_assert(ci->top <= L->stack_last); + L->top.p + LUA_MINSTACK); + lua_assert(ci->top.p <= L->stack_last.p); if (l_unlikely(L->hookmask & LUA_MASKCALL)) { - int narg = cast_int(L->top - func) - 1; + int narg = cast_int(L->top.p - func) - 1; luaD_hook(L, LUA_HOOKCALL, -1, 1, narg); } lua_unlock(L); @@ -535,17 +558,17 @@ int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int nfixparams = p->numparams; int i; checkstackGCp(L, fsize - delta, func); - ci->func -= delta; /* restore 'func' (if vararg) */ + ci->func.p -= delta; /* restore 'func' (if vararg) */ for (i = 0; i < narg1; i++) /* move down function and arguments */ - setobjs2s(L, ci->func + i, func + i); - func = ci->func; /* moved-down function */ + setobjs2s(L, ci->func.p + i, func + i); + func = ci->func.p; /* moved-down function */ for (; narg1 <= nfixparams; narg1++) setnilvalue(s2v(func + narg1)); /* complete missing arguments */ - ci->top = func + 1 + fsize; /* top for new function */ - lua_assert(ci->top <= L->stack_last); + ci->top.p = func + 1 + fsize; /* top for new function */ + lua_assert(ci->top.p <= L->stack_last.p); ci->u.l.savedpc = p->code; /* starting point */ ci->callstatus |= CIST_TAIL; - L->top = func + narg1; /* set top */ + L->top.p = func + narg1; /* set top */ return -1; } default: { /* not a function */ @@ -578,15 +601,15 @@ CallInfo *luaD_precall (lua_State *L, StkId func, int nresults) { case LUA_VLCL: { /* Lua function */ CallInfo *ci; Proto *p = clLvalue(s2v(func))->p; - int narg = cast_int(L->top - func) - 1; /* number of real arguments */ + int narg = cast_int(L->top.p - func) - 1; /* number of real arguments */ int nfixparams = p->numparams; int fsize = p->maxstacksize; /* frame size */ checkstackGCp(L, fsize, func); L->ci = ci = prepCallInfo(L, func, nresults, 0, func + 1 + fsize); ci->u.l.savedpc = p->code; /* starting point */ for (; narg < nfixparams; narg++) - setnilvalue(s2v(L->top++)); /* complete missing arguments */ - lua_assert(ci->top <= L->stack_last); + setnilvalue(s2v(L->top.p++)); /* complete missing arguments */ + lua_assert(ci->top.p <= L->stack_last.p); return ci; } default: { /* not a function */ @@ -748,8 +771,8 @@ static CallInfo *findpcall (lua_State *L) { ** coroutine error handler and should not kill the coroutine.) */ static int resume_error (lua_State *L, const char *msg, int narg) { - L->top -= narg; /* remove args from the stack */ - setsvalue2s(L, L->top, luaS_new(L, msg)); /* push error message */ + L->top.p -= narg; /* remove args from the stack */ + setsvalue2s(L, L->top.p, luaS_new(L, msg)); /* push error message */ api_incr_top(L); lua_unlock(L); return LUA_ERRRUN; @@ -765,7 +788,7 @@ static int resume_error (lua_State *L, const char *msg, int narg) { */ static void resume (lua_State *L, void *ud) { int n = *(cast(int*, ud)); /* number of arguments */ - StkId firstArg = L->top - n; /* first argument */ + StkId firstArg = L->top.p - n; /* first argument */ CallInfo *ci = L->ci; if (L->status == LUA_OK) /* starting a coroutine? */ ccall(L, firstArg - 1, LUA_MULTRET, 0); /* just call its body */ @@ -773,7 +796,7 @@ static void resume (lua_State *L, void *ud) { lua_assert(L->status == LUA_YIELD); L->status = LUA_OK; /* mark that it is running (again) */ if (isLua(ci)) { /* yielded inside a hook? */ - L->top = firstArg; /* discard arguments */ + L->top.p = firstArg; /* discard arguments */ luaV_execute(L, ci); /* just continue running Lua code */ } else { /* 'common' yield */ @@ -816,7 +839,7 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs, if (L->status == LUA_OK) { /* may be starting a coroutine */ if (L->ci != &L->base_ci) /* not in base level? */ return resume_error(L, "cannot resume non-suspended coroutine", nargs); - else if (L->top - (L->ci->func + 1) == nargs) /* no function? */ + else if (L->top.p - (L->ci->func.p + 1) == nargs) /* no function? */ return resume_error(L, "cannot resume dead coroutine", nargs); } else if (L->status != LUA_YIELD) /* ended with errors? */ @@ -834,11 +857,11 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs, lua_assert(status == L->status); /* normal end or yield */ else { /* unrecoverable error */ L->status = cast_byte(status); /* mark thread as 'dead' */ - luaD_seterrorobj(L, status, L->top); /* push error message */ - L->ci->top = L->top; + luaD_seterrorobj(L, status, L->top.p); /* push error message */ + L->ci->top.p = L->top.p; } *nresults = (status == LUA_YIELD) ? L->ci->u2.nyield - : cast_int(L->top - (L->ci->func + 1)); + : cast_int(L->top.p - (L->ci->func.p + 1)); lua_unlock(L); return status; } @@ -993,7 +1016,7 @@ int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, p.dyd.gt.arr = NULL; p.dyd.gt.size = 0; p.dyd.label.arr = NULL; p.dyd.label.size = 0; luaZ_initbuffer(L, &p.buff); - status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); + status = luaD_pcall(L, f_parser, &p, savestack(L, L->top.p), L->errfunc); luaZ_freebuffer(L, &p.buff); luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size); luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size); diff --git a/source/luametatex/source/luacore/lua54/src/ldo.h b/source/luametatex/source/luacore/lua54/src/ldo.h index 4661aa007..1aa446ad0 100644 --- a/source/luametatex/source/luacore/lua54/src/ldo.h +++ b/source/luametatex/source/luacore/lua54/src/ldo.h @@ -8,6 +8,7 @@ #define ldo_h +#include "llimits.h" #include "lobject.h" #include "lstate.h" #include "lzio.h" @@ -23,7 +24,7 @@ ** at every check. */ #define luaD_checkstackaux(L,n,pre,pos) \ - if (l_unlikely(L->stack_last - L->top <= (n))) \ + if (l_unlikely(L->stack_last.p - L->top.p <= (n))) \ { pre; luaD_growstack(L, n, 1); pos; } \ else { condmovestack(L,pre,pos); } @@ -32,8 +33,8 @@ -#define savestack(L,p) ((char *)(p) - (char *)L->stack) -#define restorestack(L,n) ((StkId)((char *)L->stack + (n))) +#define savestack(L,pt) (cast_charp(pt) - cast_charp(L->stack.p)) +#define restorestack(L,n) cast(StkId, cast_charp(L->stack.p) + (n)) /* macro to check stack size, preserving 'p' */ diff --git a/source/luametatex/source/luacore/lua54/src/lfunc.c b/source/luametatex/source/luacore/lua54/src/lfunc.c index daba0abf5..0945f241d 100644 --- a/source/luametatex/source/luacore/lua54/src/lfunc.c +++ b/source/luametatex/source/luacore/lua54/src/lfunc.c @@ -50,8 +50,8 @@ void luaF_initupvals (lua_State *L, LClosure *cl) { for (i = 0; i < cl->nupvalues; i++) { GCObject *o = luaC_newobj(L, LUA_VUPVAL, sizeof(UpVal)); UpVal *uv = gco2upv(o); - uv->v = &uv->u.value; /* make it closed */ - setnilvalue(uv->v); + uv->v.p = &uv->u.value; /* make it closed */ + setnilvalue(uv->v.p); cl->upvals[i] = uv; luaC_objbarrier(L, cl, uv); } @@ -62,12 +62,11 @@ void luaF_initupvals (lua_State *L, LClosure *cl) { ** Create a new upvalue at the given level, and link it to the list of ** open upvalues of 'L' after entry 'prev'. **/ -static UpVal *newupval (lua_State *L, int tbc, StkId level, UpVal **prev) { +static UpVal *newupval (lua_State *L, StkId level, UpVal **prev) { GCObject *o = luaC_newobj(L, LUA_VUPVAL, sizeof(UpVal)); UpVal *uv = gco2upv(o); UpVal *next = *prev; - uv->v = s2v(level); /* current value lives in the stack */ - uv->tbc = tbc; + uv->v.p = s2v(level); /* current value lives in the stack */ uv->u.open.next = next; /* link it to list of open upvalues */ uv->u.open.previous = prev; if (next) @@ -96,7 +95,7 @@ UpVal *luaF_findupval (lua_State *L, StkId level) { pp = &p->u.open.next; } /* not found: create a new upvalue after 'pp' */ - return newupval(L, 0, level, pp); + return newupval(L, level, pp); } @@ -106,12 +105,12 @@ UpVal *luaF_findupval (lua_State *L, StkId level) { ** (This function assumes EXTRA_STACK.) */ static void callclosemethod (lua_State *L, TValue *obj, TValue *err, int yy) { - StkId top = L->top; + StkId top = L->top.p; const TValue *tm = luaT_gettmbyobj(L, obj, TM_CLOSE); setobj2s(L, top, tm); /* will call metamethod... */ setobj2s(L, top + 1, obj); /* with 'self' as the 1st argument */ setobj2s(L, top + 2, err); /* and error msg. as 2nd argument */ - L->top = top + 3; /* add function and arguments */ + L->top.p = top + 3; /* add function and arguments */ if (yy) luaD_call(L, top, 0); else @@ -126,7 +125,7 @@ static void callclosemethod (lua_State *L, TValue *obj, TValue *err, int yy) { static void checkclosemth (lua_State *L, StkId level) { const TValue *tm = luaT_gettmbyobj(L, s2v(level), TM_CLOSE); if (ttisnil(tm)) { /* no metamethod? */ - int idx = cast_int(level - L->ci->func); /* variable index */ + int idx = cast_int(level - L->ci->func.p); /* variable index */ const char *vname = luaG_findlocal(L, L->ci, idx, NULL); if (vname == NULL) vname = "?"; luaG_runerror(L, "variable '%s' got a non-closable value", vname); @@ -160,23 +159,23 @@ static void prepcallclosemth (lua_State *L, StkId level, int status, int yy) { ** is used.) */ #define MAXDELTA \ - ((256ul << ((sizeof(L->stack->tbclist.delta) - 1) * 8)) - 1) + ((256ul << ((sizeof(L->stack.p->tbclist.delta) - 1) * 8)) - 1) /* ** Insert a variable in the list of to-be-closed variables. */ void luaF_newtbcupval (lua_State *L, StkId level) { - lua_assert(level > L->tbclist); + lua_assert(level > L->tbclist.p); if (l_isfalse(s2v(level))) return; /* false doesn't need to be closed */ checkclosemth(L, level); /* value must have a close method */ - while (cast_uint(level - L->tbclist) > MAXDELTA) { - L->tbclist += MAXDELTA; /* create a dummy node at maximum delta */ - L->tbclist->tbclist.delta = 0; + while (cast_uint(level - L->tbclist.p) > MAXDELTA) { + L->tbclist.p += MAXDELTA; /* create a dummy node at maximum delta */ + L->tbclist.p->tbclist.delta = 0; } - level->tbclist.delta = cast(unsigned short, level - L->tbclist); - L->tbclist = level; + level->tbclist.delta = cast(unsigned short, level - L->tbclist.p); + L->tbclist.p = level; } @@ -196,10 +195,10 @@ void luaF_closeupval (lua_State *L, StkId level) { StkId upl; /* stack index pointed by 'uv' */ while ((uv = L->openupval) != NULL && (upl = uplevel(uv)) >= level) { TValue *slot = &uv->u.value; /* new position for value */ - lua_assert(uplevel(uv) < L->top); + lua_assert(uplevel(uv) < L->top.p); luaF_unlinkupval(uv); /* remove upvalue from 'openupval' list */ - setobj(L, slot, uv->v); /* move value to upvalue slot */ - uv->v = slot; /* now current value lives here */ + setobj(L, slot, uv->v.p); /* move value to upvalue slot */ + uv->v.p = slot; /* now current value lives here */ if (!iswhite(uv)) { /* neither white nor dead? */ nw2black(uv); /* closed upvalues cannot be gray */ luaC_barrier(L, uv, slot); @@ -212,12 +211,12 @@ void luaF_closeupval (lua_State *L, StkId level) { ** Remove first element from the tbclist plus its dummy nodes. */ static void poptbclist (lua_State *L) { - StkId tbc = L->tbclist; + StkId tbc = L->tbclist.p; lua_assert(tbc->tbclist.delta > 0); /* first element cannot be dummy */ tbc -= tbc->tbclist.delta; - while (tbc > L->stack && tbc->tbclist.delta == 0) + while (tbc > L->stack.p && tbc->tbclist.delta == 0) tbc -= MAXDELTA; /* remove dummy nodes */ - L->tbclist = tbc; + L->tbclist.p = tbc; } @@ -228,8 +227,8 @@ static void poptbclist (lua_State *L) { StkId luaF_close (lua_State *L, StkId level, int status, int yy) { ptrdiff_t levelrel = savestack(L, level); luaF_closeupval(L, level); /* first, close the upvalues */ - while (L->tbclist >= level) { /* traverse tbc's down to that level */ - StkId tbc = L->tbclist; /* get variable index */ + while (L->tbclist.p >= level) { /* traverse tbc's down to that level */ + StkId tbc = L->tbclist.p; /* get variable index */ poptbclist(L); /* remove it from list */ prepcallclosemth(L, tbc, status, yy); /* close variable */ level = restorestack(L, levelrel); diff --git a/source/luametatex/source/luacore/lua54/src/lfunc.h b/source/luametatex/source/luacore/lua54/src/lfunc.h index 3d296971e..3be265efb 100644 --- a/source/luametatex/source/luacore/lua54/src/lfunc.h +++ b/source/luametatex/source/luacore/lua54/src/lfunc.h @@ -29,10 +29,10 @@ #define MAXUPVAL 255 -#define upisopen(up) ((up)->v != &(up)->u.value) +#define upisopen(up) ((up)->v.p != &(up)->u.value) -#define uplevel(up) check_exp(upisopen(up), cast(StkId, (up)->v)) +#define uplevel(up) check_exp(upisopen(up), cast(StkId, (up)->v.p)) /* diff --git a/source/luametatex/source/luacore/lua54/src/lgc.c b/source/luametatex/source/luacore/lua54/src/lgc.c index 317ea4508..2e7499025 100644 --- a/source/luametatex/source/luacore/lua54/src/lgc.c +++ b/source/luametatex/source/luacore/lua54/src/lgc.c @@ -252,12 +252,13 @@ void luaC_fix (lua_State *L, GCObject *o) { /* -** create a new collectable object (with given type and size) and link -** it to 'allgc' list. +** create a new collectable object (with given type, size, and offset) +** and link it to 'allgc' list. */ -GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { +GCObject *luaC_newobjdt (lua_State *L, int tt, size_t sz, size_t offset) { global_State *g = G(L); - GCObject *o = cast(GCObject *, luaM_newobject(L, novariant(tt), sz)); + char *p = cast_charp(luaM_newobject(L, novariant(tt), sz)); + GCObject *o = cast(GCObject *, p + offset); o->marked = luaC_white(g); o->tt = tt; o->next = g->allgc; @@ -265,6 +266,11 @@ GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { return o; } + +GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { + return luaC_newobjdt(L, tt, sz, 0); +} + /* }====================================================== */ @@ -301,7 +307,7 @@ static void reallymarkobject (global_State *g, GCObject *o) { set2gray(uv); /* open upvalues are kept gray */ else set2black(uv); /* closed upvalues are visited here */ - markvalue(g, uv->v); /* mark its content */ + markvalue(g, uv->v.p); /* mark its content */ break; } case LUA_VUSERDATA: { @@ -376,7 +382,7 @@ static int remarkupvals (global_State *g) { work++; if (!iswhite(uv)) { /* upvalue already visited? */ lua_assert(upisopen(uv) && isgray(uv)); - markvalue(g, uv->v); /* mark its value */ + markvalue(g, uv->v.p); /* mark its value */ } } } @@ -620,19 +626,19 @@ static int traverseLclosure (global_State *g, LClosure *cl) { */ static int traversethread (global_State *g, lua_State *th) { UpVal *uv; - StkId o = th->stack; + StkId o = th->stack.p; if (isold(th) || g->gcstate == GCSpropagate) linkgclist(th, g->grayagain); /* insert into 'grayagain' list */ if (o == NULL) return 1; /* stack not completely built yet */ lua_assert(g->gcstate == GCSatomic || th->openupval == NULL || isintwups(th)); - for (; o < th->top; o++) /* mark live elements in the stack */ + for (; o < th->top.p; o++) /* mark live elements in the stack */ markvalue(g, s2v(o)); for (uv = th->openupval; uv != NULL; uv = uv->u.open.next) markobject(g, uv); /* open upvalues cannot be collected */ if (g->gcstate == GCSatomic) { /* final traversal? */ - for (; o < th->stack_last + EXTRA_STACK; o++) + for (; o < th->stack_last.p + EXTRA_STACK; o++) setnilvalue(s2v(o)); /* clear dead stack slice */ /* 'remarkupvals' may have removed thread from 'twups' list */ if (!isintwups(th) && th->openupval != NULL) { @@ -892,7 +898,7 @@ static GCObject *udata2finalize (global_State *g) { static void dothecall (lua_State *L, void *ud) { UNUSED(ud); - luaD_callnoyield(L, L->top - 2, 0); + luaD_callnoyield(L, L->top.p - 2, 0); } @@ -909,16 +915,16 @@ static void GCTM (lua_State *L) { int oldgcstp = g->gcstp; g->gcstp |= GCSTPGC; /* avoid GC steps */ L->allowhook = 0; /* stop debug hooks during GC metamethod */ - setobj2s(L, L->top++, tm); /* push finalizer... */ - setobj2s(L, L->top++, &v); /* ... and its argument */ + setobj2s(L, L->top.p++, tm); /* push finalizer... */ + setobj2s(L, L->top.p++, &v); /* ... and its argument */ L->ci->callstatus |= CIST_FIN; /* will run a finalizer */ - status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); + status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top.p - 2), 0); L->ci->callstatus &= ~CIST_FIN; /* not running a finalizer anymore */ L->allowhook = oldah; /* restore hooks */ g->gcstp = oldgcstp; /* restore state */ if (l_unlikely(status != LUA_OK)) { /* error while running __gc? */ luaE_warnerror(L, "__gc"); - L->top--; /* pops error object */ + L->top.p--; /* pops error object */ } } } diff --git a/source/luametatex/source/luacore/lua54/src/lgc.h b/source/luametatex/source/luacore/lua54/src/lgc.h index 4a125634b..c960e7064 100644 --- a/source/luametatex/source/luacore/lua54/src/lgc.h +++ b/source/luametatex/source/luacore/lua54/src/lgc.h @@ -190,6 +190,8 @@ LUAI_FUNC void luaC_step (lua_State *L); LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz); +LUAI_FUNC GCObject *luaC_newobjdt (lua_State *L, int tt, size_t sz, + size_t offset); LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); LUAI_FUNC void luaC_barrierback_ (lua_State *L, GCObject *o); LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); diff --git a/source/luametatex/source/luacore/lua54/src/llex.c b/source/luametatex/source/luacore/lua54/src/llex.c index e99151787..b0dc0acc2 100644 --- a/source/luametatex/source/luacore/lua54/src/llex.c +++ b/source/luametatex/source/luacore/lua54/src/llex.c @@ -138,12 +138,12 @@ TString *luaX_newstring (LexState *ls, const char *str, size_t l) { if (!ttisnil(o)) /* string already present? */ ts = keystrval(nodefromval(o)); /* get saved copy */ else { /* not in use yet */ - TValue *stv = s2v(L->top++); /* reserve stack space for string */ + TValue *stv = s2v(L->top.p++); /* reserve stack space for string */ setsvalue(L, stv, ts); /* temporarily anchor the string */ luaH_finishset(L, ls->h, stv, o, stv); /* t[string] = string */ /* table is not a metatable, so it does not need to invalidate cache */ luaC_checkGC(L); - L->top--; /* remove string from stack */ + L->top.p--; /* remove string from stack */ } return ts; } diff --git a/source/luametatex/source/luacore/lua54/src/lobject.c b/source/luametatex/source/luacore/lua54/src/lobject.c index 03e2798ca..f73ffc6d9 100644 --- a/source/luametatex/source/luacore/lua54/src/lobject.c +++ b/source/luametatex/source/luacore/lua54/src/lobject.c @@ -413,8 +413,8 @@ typedef struct BuffFS { */ static void pushstr (BuffFS *buff, const char *str, size_t lstr) { lua_State *L = buff->L; - setsvalue2s(L, L->top, luaS_newlstr(L, str, lstr)); - L->top++; /* may use one slot from EXTRA_STACK */ + setsvalue2s(L, L->top.p, luaS_newlstr(L, str, lstr)); + L->top.p++; /* may use one slot from EXTRA_STACK */ if (!buff->pushed) /* no previous string on the stack? */ buff->pushed = 1; /* now there is one */ else /* join previous string with new one */ @@ -542,7 +542,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { addstr2buff(&buff, fmt, strlen(fmt)); /* rest of 'fmt' */ clearbuff(&buff); /* empty buffer into the stack */ lua_assert(buff.pushed == 1); - return svalue(s2v(L->top - 1)); + return svalue(s2v(L->top.p - 1)); } diff --git a/source/luametatex/source/luacore/lua54/src/lobject.h b/source/luametatex/source/luacore/lua54/src/lobject.h index 77cc606f5..556608e4a 100644 --- a/source/luametatex/source/luacore/lua54/src/lobject.h +++ b/source/luametatex/source/luacore/lua54/src/lobject.h @@ -157,6 +157,17 @@ typedef union StackValue { /* index to stack elements */ typedef StackValue *StkId; + +/* +** When reallocating the stack, change all pointers to the stack into +** proper offsets. +*/ +typedef union { + StkId p; /* actual pointer */ + ptrdiff_t offset; /* used while the stack is being reallocated */ +} StkIdRel; + + /* convert a 'StackValue' to a 'TValue' */ #define s2v(o) (&(o)->val) @@ -617,8 +628,10 @@ typedef struct Proto { */ typedef struct UpVal { CommonHeader; - lu_byte tbc; /* true if it represents a to-be-closed variable */ - TValue *v; /* points to stack or to its own value */ + union { + TValue *p; /* points to stack or to its own value */ + ptrdiff_t offset; /* used while the stack is being reallocated */ + } v; union { struct { /* (when open) */ struct UpVal *next; /* linked list */ diff --git a/source/luametatex/source/luacore/lua54/src/lparser.c b/source/luametatex/source/luacore/lua54/src/lparser.c index fe693b571..24668c248 100644 --- a/source/luametatex/source/luacore/lua54/src/lparser.c +++ b/source/luametatex/source/luacore/lua54/src/lparser.c @@ -1944,10 +1944,10 @@ LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, LexState lexstate; FuncState funcstate; LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */ - setclLvalue2s(L, L->top, cl); /* anchor it (to avoid being collected) */ + setclLvalue2s(L, L->top.p, cl); /* anchor it (to avoid being collected) */ luaD_inctop(L); lexstate.h = luaH_new(L); /* create table for scanner */ - sethvalue2s(L, L->top, lexstate.h); /* anchor it */ + sethvalue2s(L, L->top.p, lexstate.h); /* anchor it */ luaD_inctop(L); funcstate.f = cl->p = luaF_newproto(L); luaC_objbarrier(L, cl, cl->p); @@ -1961,7 +1961,7 @@ LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs); /* all scopes should be correctly finished */ lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0); - L->top--; /* remove scanner's table */ + L->top.p--; /* remove scanner's table */ return cl; /* closure is on the stack, too */ } diff --git a/source/luametatex/source/luacore/lua54/src/lstate.c b/source/luametatex/source/luacore/lua54/src/lstate.c index 1ffe1a0f7..1fbefb4b1 100644 --- a/source/luametatex/source/luacore/lua54/src/lstate.c +++ b/source/luametatex/source/luacore/lua54/src/lstate.c @@ -180,33 +180,33 @@ LUAI_FUNC void luaE_incCstack (lua_State *L) { static void stack_init (lua_State *L1, lua_State *L) { int i; CallInfo *ci; /* initialize stack array */ - L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, StackValue); - L1->tbclist = L1->stack; + L1->stack.p = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, StackValue); + L1->tbclist.p = L1->stack.p; for (i = 0; i < BASIC_STACK_SIZE + EXTRA_STACK; i++) - setnilvalue(s2v(L1->stack + i)); /* erase new stack */ - L1->top = L1->stack; - L1->stack_last = L1->stack + BASIC_STACK_SIZE; + setnilvalue(s2v(L1->stack.p + i)); /* erase new stack */ + L1->top.p = L1->stack.p; + L1->stack_last.p = L1->stack.p + BASIC_STACK_SIZE; /* initialize first ci */ ci = &L1->base_ci; ci->next = ci->previous = NULL; ci->callstatus = CIST_C; - ci->func = L1->top; + ci->func.p = L1->top.p; ci->u.c.k = NULL; ci->nresults = 0; - setnilvalue(s2v(L1->top)); /* 'function' entry for this 'ci' */ - L1->top++; - ci->top = L1->top + LUA_MINSTACK; + setnilvalue(s2v(L1->top.p)); /* 'function' entry for this 'ci' */ + L1->top.p++; + ci->top.p = L1->top.p + LUA_MINSTACK; L1->ci = ci; } static void freestack (lua_State *L) { - if (L->stack == NULL) + if (L->stack.p == NULL) return; /* stack not completely built yet */ L->ci = &L->base_ci; /* free the entire 'ci' list */ luaE_freeCI(L); lua_assert(L->nci == 0); - luaM_freearray(L, L->stack, stacksize(L) + EXTRA_STACK); /* free stack */ + luaM_freearray(L, L->stack.p, stacksize(L) + EXTRA_STACK); /* free stack */ } @@ -248,7 +248,7 @@ static void f_luaopen (lua_State *L, void *ud) { */ static void preinit_thread (lua_State *L, global_State *g) { G(L) = g; - L->stack = NULL; + L->stack.p = NULL; L->ci = NULL; L->nci = 0; L->twups = L; /* thread has no upvalues */ @@ -284,20 +284,16 @@ static void close_state (lua_State *L) { LUA_API lua_State *lua_newthread (lua_State *L) { - global_State *g; + global_State *g = G(L); + GCObject *o; lua_State *L1; lua_lock(L); - g = G(L); luaC_checkGC(L); /* create new thread */ - L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; - L1->marked = luaC_white(g); - L1->tt = LUA_VTHREAD; - /* link it on list 'allgc' */ - L1->next = g->allgc; - g->allgc = obj2gco(L1); + o = luaC_newobjdt(L, LUA_TTHREAD, sizeof(LX), offsetof(LX, l)); + L1 = gco2th(o); /* anchor it on L stack */ - setthvalue2s(L, L->top, L1); + setthvalue2s(L, L->top.p, L1); api_incr_top(L); preinit_thread(L1, g); L1->hookmask = L->hookmask; @@ -316,7 +312,7 @@ LUA_API lua_State *lua_newthread (lua_State *L) { void luaE_freethread (lua_State *L, lua_State *L1) { LX *l = fromstate(L1); - luaF_closeupval(L1, L1->stack); /* close all upvalues */ + luaF_closeupval(L1, L1->stack.p); /* close all upvalues */ lua_assert(L1->openupval == NULL); luai_userstatefree(L, L1); freestack(L1); @@ -326,26 +322,27 @@ void luaE_freethread (lua_State *L, lua_State *L1) { int luaE_resetthread (lua_State *L, int status) { CallInfo *ci = L->ci = &L->base_ci; /* unwind CallInfo list */ - setnilvalue(s2v(L->stack)); /* 'function' entry for basic 'ci' */ - ci->func = L->stack; + setnilvalue(s2v(L->stack.p)); /* 'function' entry for basic 'ci' */ + ci->func.p = L->stack.p; ci->callstatus = CIST_C; if (status == LUA_YIELD) status = LUA_OK; L->status = LUA_OK; /* so it can run __close metamethods */ status = luaD_closeprotected(L, 1, status); if (status != LUA_OK) /* errors? */ - luaD_seterrorobj(L, status, L->stack + 1); + luaD_seterrorobj(L, status, L->stack.p + 1); else - L->top = L->stack + 1; - ci->top = L->top + LUA_MINSTACK; - luaD_reallocstack(L, cast_int(ci->top - L->stack), 0); + L->top.p = L->stack.p + 1; + ci->top.p = L->top.p + LUA_MINSTACK; + luaD_reallocstack(L, cast_int(ci->top.p - L->stack.p), 0); return status; } -LUA_API int lua_resetthread (lua_State *L) { +LUA_API int lua_resetthread (lua_State *L, lua_State *from) { int status; lua_lock(L); + L->nCcalls = (from) ? getCcalls(from) : 0; status = luaE_resetthread(L, L->status); lua_unlock(L); return status; @@ -426,7 +423,7 @@ void luaE_warning (lua_State *L, const char *msg, int tocont) { ** Generate a warning from an error message */ void luaE_warnerror (lua_State *L, const char *where) { - TValue *errobj = s2v(L->top - 1); /* error object */ + TValue *errobj = s2v(L->top.p - 1); /* error object */ const char *msg = (ttisstring(errobj)) ? svalue(errobj) : "error object is not a string"; diff --git a/source/luametatex/source/luacore/lua54/src/lstate.h b/source/luametatex/source/luacore/lua54/src/lstate.h index 61e82cde7..2e9078187 100644 --- a/source/luametatex/source/luacore/lua54/src/lstate.h +++ b/source/luametatex/source/luacore/lua54/src/lstate.h @@ -139,7 +139,7 @@ struct lua_longjmp; /* defined in ldo.c */ #define BASIC_STACK_SIZE (2*LUA_MINSTACK) -#define stacksize(th) cast_int((th)->stack_last - (th)->stack) +#define stacksize(th) cast_int((th)->stack_last.p - (th)->stack.p) /* kinds of Garbage Collection */ @@ -170,8 +170,8 @@ typedef struct stringtable { ** before the function starts or after it ends. */ typedef struct CallInfo { - StkId func; /* function index in the stack */ - StkId top; /* top for this function */ + StkIdRel func; /* function index in the stack */ + StkIdRel top; /* top for this function */ struct CallInfo *previous, *next; /* dynamic call link */ union { struct { /* only for Lua functions */ @@ -306,13 +306,13 @@ struct lua_State { lu_byte status; lu_byte allowhook; unsigned short nci; /* number of items in 'ci' list */ - StkId top; /* first free slot in the stack */ + StkIdRel top; /* first free slot in the stack */ global_State *l_G; CallInfo *ci; /* call info for current function */ - StkId stack_last; /* end of stack (last element + 1) */ - StkId stack; /* stack base */ + StkIdRel stack_last; /* end of stack (last element + 1) */ + StkIdRel stack; /* stack base */ UpVal *openupval; /* list of open upvalues in this stack */ - StkId tbclist; /* list of to-be-closed variables */ + StkIdRel tbclist; /* list of to-be-closed variables */ GCObject *gclist; struct lua_State *twups; /* list of threads with open upvalues */ struct lua_longjmp *errorJmp; /* current error recover point */ diff --git a/source/luametatex/source/luacore/lua54/src/ltable.c b/source/luametatex/source/luacore/lua54/src/ltable.c index d03e74865..cc7993e08 100644 --- a/source/luametatex/source/luacore/lua54/src/ltable.c +++ b/source/luametatex/source/luacore/lua54/src/ltable.c @@ -975,6 +975,4 @@ Node *luaH_mainposition (const Table *t, const TValue *key) { return mainpositionTV(t, key); } -int luaH_isdummy (const Table *t) { return isdummy(t); } - #endif diff --git a/source/luametatex/source/luacore/lua54/src/ltable.h b/source/luametatex/source/luacore/lua54/src/ltable.h index 7bbbcb213..75dd9e26e 100644 --- a/source/luametatex/source/luacore/lua54/src/ltable.h +++ b/source/luametatex/source/luacore/lua54/src/ltable.h @@ -59,7 +59,6 @@ LUAI_FUNC unsigned int luaH_realasize (const Table *t); #if defined(LUA_DEBUG) LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); -LUAI_FUNC int luaH_isdummy (const Table *t); #endif diff --git a/source/luametatex/source/luacore/lua54/src/ltm.c b/source/luametatex/source/luacore/lua54/src/ltm.c index b657b783a..07a060811 100644 --- a/source/luametatex/source/luacore/lua54/src/ltm.c +++ b/source/luametatex/source/luacore/lua54/src/ltm.c @@ -102,12 +102,12 @@ const char *luaT_objtypename (lua_State *L, const TValue *o) { void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, const TValue *p3) { - StkId func = L->top; + StkId func = L->top.p; setobj2s(L, func, f); /* push function (assume EXTRA_STACK) */ setobj2s(L, func + 1, p1); /* 1st argument */ setobj2s(L, func + 2, p2); /* 2nd argument */ setobj2s(L, func + 3, p3); /* 3rd argument */ - L->top = func + 4; + L->top.p = func + 4; /* metamethod may yield only when called from Lua code */ if (isLuacode(L->ci)) luaD_call(L, func, 0); @@ -119,18 +119,18 @@ void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, void luaT_callTMres (lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, StkId res) { ptrdiff_t result = savestack(L, res); - StkId func = L->top; + StkId func = L->top.p; setobj2s(L, func, f); /* push function (assume EXTRA_STACK) */ setobj2s(L, func + 1, p1); /* 1st argument */ setobj2s(L, func + 2, p2); /* 2nd argument */ - L->top += 3; + L->top.p += 3; /* metamethod may yield only when called from Lua code */ if (isLuacode(L->ci)) luaD_call(L, func, 1); else luaD_callnoyield(L, func, 1); res = restorestack(L, result); - setobjs2s(L, res, --L->top); /* move result to its place */ + setobjs2s(L, res, --L->top.p); /* move result to its place */ } @@ -165,7 +165,7 @@ void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, void luaT_tryconcatTM (lua_State *L) { - StkId top = L->top; + StkId top = L->top.p; if (l_unlikely(!callbinTM(L, s2v(top - 2), s2v(top - 1), top - 2, TM_CONCAT))) luaG_concaterror(L, s2v(top - 2), s2v(top - 1)); @@ -200,15 +200,15 @@ void luaT_trybiniTM (lua_State *L, const TValue *p1, lua_Integer i2, */ int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, TMS event) { - if (callbinTM(L, p1, p2, L->top, event)) /* try original event */ - return !l_isfalse(s2v(L->top)); + if (callbinTM(L, p1, p2, L->top.p, event)) /* try original event */ + return !l_isfalse(s2v(L->top.p)); #if defined(LUA_COMPAT_LT_LE) else if (event == TM_LE) { /* try '!(p2 < p1)' for '(p1 <= p2)' */ L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */ - if (callbinTM(L, p2, p1, L->top, TM_LT)) { + if (callbinTM(L, p2, p1, L->top.p, TM_LT)) { L->ci->callstatus ^= CIST_LEQ; /* clear mark */ - return l_isfalse(s2v(L->top)); + return l_isfalse(s2v(L->top.p)); } /* else error will remove this 'ci'; no need to clear mark */ } @@ -238,20 +238,20 @@ int luaT_callorderiTM (lua_State *L, const TValue *p1, int v2, void luaT_adjustvarargs (lua_State *L, int nfixparams, CallInfo *ci, const Proto *p) { int i; - int actual = cast_int(L->top - ci->func) - 1; /* number of arguments */ + int actual = cast_int(L->top.p - ci->func.p) - 1; /* number of arguments */ int nextra = actual - nfixparams; /* number of extra arguments */ ci->u.l.nextraargs = nextra; luaD_checkstack(L, p->maxstacksize + 1); /* copy function to the top of the stack */ - setobjs2s(L, L->top++, ci->func); + setobjs2s(L, L->top.p++, ci->func.p); /* move fixed parameters to the top of the stack */ for (i = 1; i <= nfixparams; i++) { - setobjs2s(L, L->top++, ci->func + i); - setnilvalue(s2v(ci->func + i)); /* erase original parameter (for GC) */ + setobjs2s(L, L->top.p++, ci->func.p + i); + setnilvalue(s2v(ci->func.p + i)); /* erase original parameter (for GC) */ } - ci->func += actual + 1; - ci->top += actual + 1; - lua_assert(L->top <= ci->top && ci->top <= L->stack_last); + ci->func.p += actual + 1; + ci->top.p += actual + 1; + lua_assert(L->top.p <= ci->top.p && ci->top.p <= L->stack_last.p); } @@ -261,10 +261,10 @@ void luaT_getvarargs (lua_State *L, CallInfo *ci, StkId where, int wanted) { if (wanted < 0) { wanted = nextra; /* get all extra arguments available */ checkstackGCp(L, nextra, where); /* ensure stack space */ - L->top = where + nextra; /* next instruction will need top */ + L->top.p = where + nextra; /* next instruction will need top */ } for (i = 0; i < wanted && i < nextra; i++) - setobjs2s(L, where + i, ci->func - nextra + i); + setobjs2s(L, where + i, ci->func.p - nextra + i); for (; i < wanted; i++) /* complete required results with nil */ setnilvalue(s2v(where + i)); } diff --git a/source/luametatex/source/luacore/lua54/src/lua.h b/source/luametatex/source/luacore/lua54/src/lua.h index 219784cc0..bfba4d1e1 100644 --- a/source/luametatex/source/luacore/lua54/src/lua.h +++ b/source/luametatex/source/luacore/lua54/src/lua.h @@ -153,7 +153,7 @@ extern const char lua_ident[]; LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); LUA_API void (lua_close) (lua_State *L); LUA_API lua_State *(lua_newthread) (lua_State *L); -LUA_API int (lua_resetthread) (lua_State *L); +LUA_API int (lua_resetthread) (lua_State *L, lua_State *from); LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); diff --git a/source/luametatex/source/luacore/lua54/src/lundump.c b/source/luametatex/source/luacore/lua54/src/lundump.c index 5aa55c445..aba93f828 100644 --- a/source/luametatex/source/luacore/lua54/src/lundump.c +++ b/source/luametatex/source/luacore/lua54/src/lundump.c @@ -120,10 +120,10 @@ static TString *loadStringN (LoadState *S, Proto *p) { } else { /* long string */ ts = luaS_createlngstrobj(L, size); /* create string */ - setsvalue2s(L, L->top, ts); /* anchor it ('loadVector' can GC) */ + setsvalue2s(L, L->top.p, ts); /* anchor it ('loadVector' can GC) */ luaD_inctop(L); loadVector(S, getstr(ts), size); /* load directly in final place */ - L->top--; /* pop string */ + L->top.p--; /* pop string */ } luaC_objbarrier(L, p, ts); return ts; @@ -321,7 +321,7 @@ LClosure *luaU_undump(lua_State *L, ZIO *Z, const char *name) { S.Z = Z; checkHeader(&S); cl = luaF_newLclosure(L, loadByte(&S)); - setclLvalue2s(L, L->top, cl); + setclLvalue2s(L, L->top.p, cl); luaD_inctop(L); cl->p = luaF_newproto(L); luaC_objbarrier(L, cl, cl->p); diff --git a/source/luametatex/source/luacore/lua54/src/lvm.c b/source/luametatex/source/luacore/lua54/src/lvm.c index 73a19ba9b..2e84dc63c 100644 --- a/source/luametatex/source/luacore/lua54/src/lvm.c +++ b/source/luametatex/source/luacore/lua54/src/lvm.c @@ -608,8 +608,8 @@ int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { if (tm == NULL) /* no TM? */ return 0; /* objects are different */ else { - luaT_callTMres(L, tm, t1, t2, L->top); /* call TM */ - return !l_isfalse(s2v(L->top)); + luaT_callTMres(L, tm, t1, t2, L->top.p); /* call TM */ + return !l_isfalse(s2v(L->top.p)); } } @@ -633,13 +633,13 @@ static void copy2buff (StkId top, int n, char *buff) { /* ** Main operation for concatenation: concat 'total' values in the stack, -** from 'L->top - total' up to 'L->top - 1'. +** from 'L->top.p - total' up to 'L->top.p - 1'. */ void luaV_concat (lua_State *L, int total) { if (total == 1) return; /* "all" values already concatenated */ do { - StkId top = L->top; + StkId top = L->top.p; int n = 2; /* number of elements handled in this pass (at least 2) */ if (!(ttisstring(s2v(top - 2)) || cvt2str(s2v(top - 2))) || !tostring(L, s2v(top - 1))) @@ -657,7 +657,7 @@ void luaV_concat (lua_State *L, int total) { for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) { size_t l = vslen(s2v(top - n - 1)); if (l_unlikely(l >= (MAX_SIZE/sizeof(char)) - tl)) { - L->top = top - total; /* pop strings to avoid wasting stack */ + L->top.p = top - total; /* pop strings to avoid wasting stack */ luaG_runerror(L, "string length overflow"); } tl += l; @@ -674,7 +674,7 @@ void luaV_concat (lua_State *L, int total) { setsvalue2s(L, top - n, ts); /* create result */ } total -= n - 1; /* got 'n' strings to create one new */ - L->top -= n - 1; /* popped 'n' strings and pushed one */ + L->top.p -= n - 1; /* popped 'n' strings and pushed one */ } while (total > 1); /* repeat until only 1 result left */ } @@ -808,26 +808,26 @@ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, */ void luaV_finishOp (lua_State *L) { CallInfo *ci = L->ci; - StkId base = ci->func + 1; + StkId base = ci->func.p + 1; Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ OpCode op = GET_OPCODE(inst); switch (op) { /* finish its execution */ case OP_MMBIN: case OP_MMBINI: case OP_MMBINK: { - setobjs2s(L, base + GETARG_A(*(ci->u.l.savedpc - 2)), --L->top); + setobjs2s(L, base + GETARG_A(*(ci->u.l.savedpc - 2)), --L->top.p); break; } case OP_UNM: case OP_BNOT: case OP_LEN: case OP_GETTABUP: case OP_GETTABLE: case OP_GETI: case OP_GETFIELD: case OP_SELF: { - setobjs2s(L, base + GETARG_A(inst), --L->top); + setobjs2s(L, base + GETARG_A(inst), --L->top.p); break; } case OP_LT: case OP_LE: case OP_LTI: case OP_LEI: case OP_GTI: case OP_GEI: case OP_EQ: { /* note that 'OP_EQI'/'OP_EQK' cannot yield */ - int res = !l_isfalse(s2v(L->top - 1)); - L->top--; + int res = !l_isfalse(s2v(L->top.p - 1)); + L->top.p--; #if defined(LUA_COMPAT_LT_LE) if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ ci->callstatus ^= CIST_LEQ; /* clear mark */ @@ -840,11 +840,11 @@ void luaV_finishOp (lua_State *L) { break; } case OP_CONCAT: { - StkId top = L->top - 1; /* top when 'luaT_tryconcatTM' was called */ + StkId top = L->top.p - 1; /* top when 'luaT_tryconcatTM' was called */ int a = GETARG_A(inst); /* first element to concatenate */ int total = cast_int(top - 1 - (base + a)); /* yet to concatenate */ setobjs2s(L, top - 2, top); /* put TM result in proper position */ - L->top = top - 1; /* top is one after last element (at top-2) */ + L->top.p = top - 1; /* top is one after last element (at top-2) */ luaV_concat(L, total); /* concat them (may yield again) */ break; } @@ -856,7 +856,7 @@ void luaV_finishOp (lua_State *L) { StkId ra = base + GETARG_A(inst); /* adjust top to signal correct number of returns, in case the return is "up to top" ('isIT') */ - L->top = ra + ci->u2.nres; + L->top.p = ra + ci->u2.nres; /* repeat instruction to close other vars. and complete the return */ ci->u.l.savedpc--; break; @@ -1069,7 +1069,7 @@ void luaV_finishOp (lua_State *L) { #define updatetrap(ci) (trap = ci->u.l.trap) -#define updatebase(ci) (base = ci->func + 1) +#define updatebase(ci) (base = ci->func.p + 1) #define updatestack(ci) \ @@ -1104,7 +1104,7 @@ void luaV_finishOp (lua_State *L) { ** Whenever code can raise errors, the global 'pc' and the global ** 'top' must be correct to report occasional errors. */ -#define savestate(L,ci) (savepc(L), L->top = ci->top) +#define savestate(L,ci) (savepc(L), L->top.p = ci->top.p) /* @@ -1124,7 +1124,7 @@ void luaV_finishOp (lua_State *L) { /* 'c' is the limit of live values in the stack */ #define checkGC(L,c) \ - { luaC_condGC(L, (savepc(L), L->top = (c)), \ + { luaC_condGC(L, (savepc(L), L->top.p = (c)), \ updatetrap(ci)); \ luai_threadyield(L); } @@ -1155,7 +1155,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { startfunc: trap = L->hookmask; returning: /* trap already set */ - cl = clLvalue(s2v(ci->func)); + cl = clLvalue(s2v(ci->func.p)); k = cl->p->k; pc = ci->u.l.savedpc; if (l_unlikely(trap)) { @@ -1167,7 +1167,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { } ci->u.l.trap = 1; /* assume trap is on, for now */ } - base = ci->func + 1; + base = ci->func.p + 1; /* main loop of interpreter */ for (;;) { Instruction i; /* instruction being executed */ @@ -1176,10 +1176,10 @@ void luaV_execute (lua_State *L, CallInfo *ci) { /* low-level line tracing for debugging Lua */ printf("line: %d\n", luaG_getfuncline(cl->p, pcRel(pc, cl->p))); #endif - lua_assert(base == ci->func + 1); - lua_assert(base <= L->top && L->top <= L->stack_last); + lua_assert(base == ci->func.p + 1); + lua_assert(base <= L->top.p && L->top.p <= L->stack_last.p); /* invalidate top for instructions not expecting it */ - lua_assert(isIT(i) || (cast_void(L->top = base), 1)); + lua_assert(isIT(i) || (cast_void(L->top.p = base), 1)); vmdispatch (GET_OPCODE(i)) { vmcase(OP_MOVE) { StkId ra = RA(i); @@ -1238,20 +1238,20 @@ void luaV_execute (lua_State *L, CallInfo *ci) { vmcase(OP_GETUPVAL) { StkId ra = RA(i); int b = GETARG_B(i); - setobj2s(L, ra, cl->upvals[b]->v); + setobj2s(L, ra, cl->upvals[b]->v.p); vmbreak; } vmcase(OP_SETUPVAL) { StkId ra = RA(i); UpVal *uv = cl->upvals[GETARG_B(i)]; - setobj(L, uv->v, s2v(ra)); + setobj(L, uv->v.p, s2v(ra)); luaC_barrier(L, uv, s2v(ra)); vmbreak; } vmcase(OP_GETTABUP) { StkId ra = RA(i); const TValue *slot; - TValue *upval = cl->upvals[GETARG_B(i)]->v; + TValue *upval = cl->upvals[GETARG_B(i)]->v.p; TValue *rc = KC(i); TString *key = tsvalue(rc); /* key must be a string */ if (luaV_fastget(L, upval, key, slot, luaH_getshortstr)) { @@ -1306,7 +1306,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { } vmcase(OP_SETTABUP) { const TValue *slot; - TValue *upval = cl->upvals[GETARG_A(i)]->v; + TValue *upval = cl->upvals[GETARG_A(i)]->v.p; TValue *rb = KB(i); TValue *rc = RKC(i); TString *key = tsvalue(rb); /* key must be a string */ @@ -1371,7 +1371,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { if (TESTARG_k(i)) /* non-zero extra argument? */ c += GETARG_Ax(*pc) * (MAXARG_C + 1); /* add it to size */ pc++; /* skip extra argument */ - L->top = ra + 1; /* correct top in case of emergency GC */ + L->top.p = ra + 1; /* correct top in case of emergency GC */ t = luaH_new(L); /* memory allocation */ sethvalue2s(L, ra, t); if (b != 0 || c != 0) @@ -1578,9 +1578,9 @@ void luaV_execute (lua_State *L, CallInfo *ci) { vmcase(OP_CONCAT) { StkId ra = RA(i); int n = GETARG_B(i); /* number of elements to concatenate */ - L->top = ra + n; /* mark the end of concat operands */ + L->top.p = ra + n; /* mark the end of concat operands */ ProtectNT(luaV_concat(L, n)); - checkGC(L, L->top); /* 'luaV_concat' ensures correct top */ + checkGC(L, L->top.p); /* 'luaV_concat' ensures correct top */ vmbreak; } vmcase(OP_CLOSE) { @@ -1674,7 +1674,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { int b = GETARG_B(i); int nresults = GETARG_C(i) - 1; if (b != 0) /* fixed number of arguments? */ - L->top = ra + b; /* top signals number of arguments */ + L->top.p = ra + b; /* top signals number of arguments */ /* else previous instruction set top */ savepc(L); /* in case of errors */ if ((newci = luaD_precall(L, ra, nresults)) == NULL) @@ -1693,19 +1693,19 @@ void luaV_execute (lua_State *L, CallInfo *ci) { /* delta is virtual 'func' - real 'func' (vararg functions) */ int delta = (nparams1) ? ci->u.l.nextraargs + nparams1 : 0; if (b != 0) - L->top = ra + b; + L->top.p = ra + b; else /* previous instruction set top */ - b = cast_int(L->top - ra); + b = cast_int(L->top.p - ra); savepc(ci); /* several calls here can raise errors */ if (TESTARG_k(i)) { luaF_closeupval(L, base); /* close upvalues from current call */ - lua_assert(L->tbclist < base); /* no pending tbc variables */ - lua_assert(base == ci->func + 1); + lua_assert(L->tbclist.p < base); /* no pending tbc variables */ + lua_assert(base == ci->func.p + 1); } if ((n = luaD_pretailcall(L, ci, ra, b, delta)) < 0) /* Lua function? */ goto startfunc; /* execute the callee */ else { /* C function? */ - ci->func -= delta; /* restore 'func' (if vararg) */ + ci->func.p -= delta; /* restore 'func' (if vararg) */ luaD_poscall(L, ci, n); /* finish caller */ updatetrap(ci); /* 'luaD_poscall' can change hooks */ goto ret; /* caller returns after the tail call */ @@ -1716,19 +1716,19 @@ void luaV_execute (lua_State *L, CallInfo *ci) { int n = GETARG_B(i) - 1; /* number of results */ int nparams1 = GETARG_C(i); if (n < 0) /* not fixed? */ - n = cast_int(L->top - ra); /* get what is available */ + n = cast_int(L->top.p - ra); /* get what is available */ savepc(ci); if (TESTARG_k(i)) { /* may there be open upvalues? */ ci->u2.nres = n; /* save number of returns */ - if (L->top < ci->top) - L->top = ci->top; + if (L->top.p < ci->top.p) + L->top.p = ci->top.p; luaF_close(L, base, CLOSEKTOP, 1); updatetrap(ci); updatestack(ci); } if (nparams1) /* vararg function? */ - ci->func -= ci->u.l.nextraargs + nparams1; - L->top = ra + n; /* set call for 'luaD_poscall' */ + ci->func.p -= ci->u.l.nextraargs + nparams1; + L->top.p = ra + n; /* set call for 'luaD_poscall' */ luaD_poscall(L, ci, n); updatetrap(ci); /* 'luaD_poscall' can change hooks */ goto ret; @@ -1736,7 +1736,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { vmcase(OP_RETURN0) { if (l_unlikely(L->hookmask)) { StkId ra = RA(i); - L->top = ra; + L->top.p = ra; savepc(ci); luaD_poscall(L, ci, 0); /* no hurry... */ trap = 1; @@ -1744,16 +1744,16 @@ void luaV_execute (lua_State *L, CallInfo *ci) { else { /* do the 'poscall' here */ int nres; L->ci = ci->previous; /* back to caller */ - L->top = base - 1; + L->top.p = base - 1; for (nres = ci->nresults; l_unlikely(nres > 0); nres--) - setnilvalue(s2v(L->top++)); /* all results are nil */ + setnilvalue(s2v(L->top.p++)); /* all results are nil */ } goto ret; } vmcase(OP_RETURN1) { if (l_unlikely(L->hookmask)) { StkId ra = RA(i); - L->top = ra + 1; + L->top.p = ra + 1; savepc(ci); luaD_poscall(L, ci, 1); /* no hurry... */ trap = 1; @@ -1762,13 +1762,13 @@ void luaV_execute (lua_State *L, CallInfo *ci) { int nres = ci->nresults; L->ci = ci->previous; /* back to caller */ if (nres == 0) - L->top = base - 1; /* asked for no results */ + L->top.p = base - 1; /* asked for no results */ else { StkId ra = RA(i); setobjs2s(L, base - 1, ra); /* at least this result */ - L->top = base; + L->top.p = base; for (; l_unlikely(nres > 1); nres--) - setnilvalue(s2v(L->top++)); /* complete missing results */ + setnilvalue(s2v(L->top.p++)); /* complete missing results */ } } ret: /* return from a Lua function */ @@ -1824,7 +1824,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { */ /* push function, state, and control variable */ memcpy(ra + 4, ra, 3 * sizeof(*ra)); - L->top = ra + 4 + 3; + L->top.p = ra + 4 + 3; ProtectNT(luaD_call(L, ra + 4, GETARG_C(i))); /* do the call */ updatestack(ci); /* stack may have changed */ i = *(pc++); /* go to next instruction */ @@ -1846,9 +1846,9 @@ void luaV_execute (lua_State *L, CallInfo *ci) { unsigned int last = GETARG_C(i); Table *h = hvalue(s2v(ra)); if (n == 0) - n = cast_int(L->top - ra) - 1; /* get up to the top */ + n = cast_int(L->top.p - ra) - 1; /* get up to the top */ else - L->top = ci->top; /* correct top in case of emergency GC */ + L->top.p = ci->top.p; /* correct top in case of emergency GC */ last += n; if (TESTARG_k(i)) { last += GETARG_Ax(*pc) * (MAXARG_C + 1); diff --git a/source/luametatex/source/luacore/luac/luac.c b/source/luametatex/source/luacore/luac/luac.c index 56ddc4148..39b63f855 100644 --- a/source/luametatex/source/luacore/luac/luac.c +++ b/source/luametatex/source/luacore/luac/luac.c @@ -138,7 +138,7 @@ static const char* reader(lua_State* L, void* ud, size_t* size) } } -#define toproto(L,i) getproto(s2v(L->top+(i))) +#define toproto(L,i) getproto(s2v(L->top.p+(i))) static const Proto* combine(lua_State* L, int n) { diff --git a/source/luametatex/source/luacore/luasocket/src/options.c b/source/luametatex/source/luacore/luasocket/src/options.c index 2b53c67b7..e68a2bcb0 100644 --- a/source/luametatex/source/luacore/luasocket/src/options.c +++ b/source/luametatex/source/luacore/luasocket/src/options.c @@ -2,6 +2,9 @@ * Common option interface * LuaSocket toolkit \*=========================================================================*/ + +# define _WIN32_WINNT _WIN32_WINNT_WIN8 + #include "luasocket.h" #include "auxiliar.h" #include "options.h" diff --git a/source/luametatex/source/luametatex.h b/source/luametatex/source/luametatex.h index 736d21173..514eb191d 100644 --- a/source/luametatex/source/luametatex.h +++ b/source/luametatex/source/luametatex.h @@ -89,7 +89,7 @@ # define luametatex_version 210 # define luametatex_revision 02 # define luametatex_version_string "2.10.02" -# define luametatex_development_id 20221019 +# define luametatex_development_id 20221105 # define luametatex_name_camelcase "LuaMetaTeX" # define luametatex_name_lowercase "luametatex" @@ -313,6 +313,7 @@ extern version_state_info lmt_version_state; # include "lua/lmtlanguagelib.h" # include "lua/lmtfontlib.h" # include "lua/lmtlualib.h" +# include "lua/lmtluaclib.h" # include "lua/lmttexlib.h" # include "lua/lmtenginelib.h" diff --git a/source/luametatex/source/luaoptional/lmtcurl.c b/source/luametatex/source/luaoptional/lmtcurl.c index 6a54174e5..d6a5dcf26 100644 --- a/source/luametatex/source/luaoptional/lmtcurl.c +++ b/source/luametatex/source/luaoptional/lmtcurl.c @@ -383,6 +383,7 @@ static int curllib_fetch(lua_State * L) if (lua_type(L,1) == LUA_TTABLE) { curl_instance *curl = curllib_state.curl_easy_init(); if (curl) { + int result; luaL_Buffer buffer; luaL_buffinit(L, &buffer); curllib_state.curl_easy_setopt(curl, curl_object_base + curl_option_writedata, &buffer); @@ -422,7 +423,7 @@ static int curllib_fetch(lua_State * L) } lua_pop(L, 1); /* removes 'value' and keeps 'key' for next iteration */ } - int result = curllib_state.curl_easy_perform(curl); + result = curllib_state.curl_easy_perform(curl); if (result) { lua_pushboolean(L, 0); lua_pushstring(L, curllib_state.curl_easy_strerror(result)); diff --git a/source/luametatex/source/luaoptional/lmtforeign.c b/source/luametatex/source/luaoptional/lmtforeign.c index da04eca12..b4cf014a8 100644 --- a/source/luametatex/source/luaoptional/lmtforeign.c +++ b/source/luametatex/source/luaoptional/lmtforeign.c @@ -918,7 +918,7 @@ static int foreignlib_function_call(lua_State *L) case foreign_type_ulong : { unsigned long r; foreign_state.ffi_call(cif, function->function, &r, arguments); lua_pushinteger(L, (unsigned long) r); break; } case foreign_type_longlong : { long long r; foreign_state.ffi_call(cif, function->function, &r, arguments); lua_pushinteger(L, (lua_Integer) r); break; } case foreign_type_ulonglong: { unsigned long long r; foreign_state.ffi_call(cif, function->function, &r, arguments); lua_pushinteger(L, (lua_Integer) r); break; } - case foreign_type_float : { float r; foreign_state.ffi_call(cif, function->function, &r, arguments); lua_pushnumber (L, r); break; } + case foreign_type_float : { float r; foreign_state.ffi_call(cif, function->function, &r, arguments); lua_pushnumber (L, (lua_Number) r); break; } case foreign_type_double : { double r; foreign_state.ffi_call(cif, function->function, &r, arguments); lua_pushnumber (L, r); break; } case foreign_type_size_t : { size_t r; foreign_state.ffi_call(cif, function->function, &r, arguments); lua_pushinteger(L, r); break; } case foreign_type_string : diff --git a/source/luametatex/source/luaoptional/lmtgraphicsmagick.c b/source/luametatex/source/luaoptional/lmtgraphicsmagick.c index c71c68c8c..51b30a745 100644 --- a/source/luametatex/source/luaoptional/lmtgraphicsmagick.c +++ b/source/luametatex/source/luaoptional/lmtgraphicsmagick.c @@ -147,7 +147,7 @@ static int gmlib_execute(lua_State * L) } if (lua_getfield(L, -1, "noise" ) == LUA_TTABLE) { lua_getfield(L, -1, "type"); - gmlib_state.gm_MagickAddNoiseImage(wand, lua_tointeger(L, -1)); + gmlib_state.gm_MagickAddNoiseImage(wand, lmt_tointeger(L, -1)); lua_pop(L, 2); } else { lua_pop(L, 1); diff --git a/source/luametatex/source/luaoptional/lmthb.c b/source/luametatex/source/luaoptional/lmthb.c index d853256cf..03c4a1720 100644 --- a/source/luametatex/source/luaoptional/lmthb.c +++ b/source/luametatex/source/luaoptional/lmthb.c @@ -3,6 +3,7 @@ */ # include "luametatex.h" +# include "lmtoptional.h" /*tex @@ -473,9 +474,9 @@ static int hblib_load_font(lua_State * L) hb_face_t *face = hblib_state.hb_face_create(blob, id); unsigned int scale = hblib_state.hb_face_get_upem(face); hb_font_t *font = hblib_state.hb_font_create(face); + hblib_data *data = lua_newuserdatauv(L, sizeof(data), 0); hblib_state.hb_font_set_scale(font, scale, scale); hblib_state.hb_ot_font_set_funcs(font); - hblib_data *data = lua_newuserdatauv(L, sizeof(data), 0); data->font = font; luaL_getmetatable(L, HBLIB_METATABLE); lua_setmetatable(L, -2); diff --git a/source/luametatex/source/luaoptional/lmtlz4.c b/source/luametatex/source/luaoptional/lmtlz4.c index d54442635..4d4542ac3 100644 --- a/source/luametatex/source/luaoptional/lmtlz4.c +++ b/source/luametatex/source/luaoptional/lmtlz4.c @@ -5,6 +5,7 @@ # include <stdlib.h> # include "luametatex.h" +# include "lmtoptional.h" # define LZ4F_VERSION 100 /* used to check for an incompatible API breaking change */ diff --git a/source/luametatex/source/luaoptional/lmtlzma.c b/source/luametatex/source/luaoptional/lmtlzma.c index 6ffe6fedf..e7b7db5b5 100644 --- a/source/luametatex/source/luaoptional/lmtlzma.c +++ b/source/luametatex/source/luaoptional/lmtlzma.c @@ -5,6 +5,7 @@ # include <stdlib.h> # include "luametatex.h" +# include "lmtoptional.h" /* We only need a few definitions and it's nice that they are already prepared for extensions. diff --git a/source/luametatex/source/luaoptional/lmtlzo.c b/source/luametatex/source/luaoptional/lmtlzo.c index 766e824ca..375a54bcb 100644 --- a/source/luametatex/source/luaoptional/lmtlzo.c +++ b/source/luametatex/source/luaoptional/lmtlzo.c @@ -5,6 +5,7 @@ # include <stdlib.h> # include "luametatex.h" +# include "lmtoptional.h" # define lzo_output_length(n) (n + n / 16 + 64 + 64) /* we add 64 instead of 3 */ diff --git a/source/luametatex/source/luarest/lmtiolibext.c b/source/luametatex/source/luarest/lmtiolibext.c index 319eb40c6..b78735504 100644 --- a/source/luametatex/source/luarest/lmtiolibext.c +++ b/source/luametatex/source/luarest/lmtiolibext.c @@ -1095,7 +1095,7 @@ static int fiolib_readcline(lua_State *L) FILE *f = lmt_valid_file(L); if (f) { luaL_Buffer buf; - int c; + int c = 0; int n = 0; luaL_buffinit(L, &buf); do { @@ -1178,7 +1178,7 @@ static int fiolib_readcstring(lua_State *L) FILE *f = lmt_valid_file(L); if (f) { luaL_Buffer buf; - int c; + int c = 0; int n = 0; luaL_buffinit(L, &buf); do { diff --git a/source/luametatex/source/luarest/lmtsparselib.c b/source/luametatex/source/luarest/lmtsparselib.c index a5b599cea..74ecb63f4 100644 --- a/source/luametatex/source/luarest/lmtsparselib.c +++ b/source/luametatex/source/luarest/lmtsparselib.c @@ -52,17 +52,17 @@ static int sparselib_new(lua_State *L) switch (bytes) { case 1: { - unsigned char d = (defval < 0 ? 0 : (defval > 0xFF ? 0xFF : defval)); + int d = defval < 0 ? 0 : (defval > 0xFF ? 0xFF : defval); for (int i = 0; i <= 3; i++) { - item.uchar_value[i] = d ; + item.uchar_value[i] = (unsigned char) d; } break; } case 2: { - unsigned short d = (defval < 0 ? 0 : (defval > 0xFFFF ? 0xFFFF : defval)); + int d = defval < 0 ? 0 : (defval > 0xFFFF ? 0xFFFF : defval); for (int i = 0; i <= 1; i++) { - item.ushort_value[i] = d ; + item.ushort_value[i] = (unsigned short) d; } break; } diff --git a/source/luametatex/source/mp/mpc/mp.c b/source/luametatex/source/mp/mpc/mp.c index 993bf98fb..beb836de6 100644 --- a/source/luametatex/source/mp/mpc/mp.c +++ b/source/luametatex/source/mp/mpc/mp.c @@ -54,9 +54,9 @@ # define max_num_knot_nodes 1000 # define max_num_value_nodes 1000 # define max_num_symbolic_nodes 1000 -# define mp_link(A) (A)->link -# define mp_type(A) (A)->type -# define mp_name_type(A) (A)->name_type +//define mp_link(A) (A)->link +//define mp_type(A) (A)->type +//define mp_name_type(A) (A)->name_type # define mp_set_link(A,B) (A)->link = (mp_node) (B) # define mp_max_command_code mp_stop # define mp_max_pre_command mp_etex_command @@ -143,8 +143,6 @@ # define one_third_inf_t mp->math->md_one_third_inf_t # define mp_copy_pen(mp,A) mp_make_pen(mp, mp_copy_path(mp, (A)),0) # define mp_pen_is_elliptical(A) ((A)==mp_next_knot((A))) -# define mp_fraction mp_number -# define mp_angle mp_number # define new_number(A) mp->math->md_allocate(mp, &(A), mp_scaled_type) # define new_fraction(A) mp->math->md_allocate(mp, &(A), mp_fraction_type) # define new_angle(A) mp->math->md_allocate(mp, &(A), mp_angle_type) @@ -243,8 +241,8 @@ # define mp_line_cap(A) ((mp_shape_node) (A))->linecap # define mp_line_join(A) ((mp_shape_node) (A))->linejoin # define mp_miterlimit(A) ((mp_shape_node) (A))->miterlimit -# define mp_set_linecap(A,B) ((mp_shape_node) (A))->linecap = (short) (B) -# define mp_set_linejoin(A,B) ((mp_shape_node) (A))->linejoin = (short) (B) +# define mp_set_linecap(A,B) ((mp_shape_node) (A))->linecap = (unsigned char) (B) +# define mp_set_linejoin(A,B) ((mp_shape_node) (A))->linejoin = (unsigned char) (B) # define mp_pre_script(A) ((mp_shape_node) (A))->pre_script # define mp_post_script(A) ((mp_shape_node) (A))->post_script # define mp_color_model(A) ((mp_shape_node) (A))->color_model @@ -259,11 +257,11 @@ # define mp_blue_color(A) ((mp_shape_node) (A))->blue # define mp_gray_color(A) ((mp_shape_node) (A))->grey # define mp_grey_color(A) ((mp_shape_node) (A))->grey -# define mp_has_color(A) (mp_type((A))<mp_start_clip_node_type) -# define mp_has_script(A) (mp_type((A))<=mp_start_bounds_node_type) -# define mp_has_pen(A) (mp_type((A))<=mp_stroked_node_type) -# define mp_is_start_or_stop(A) (mp_type((A))>=mp_start_clip_node_type) -# define mp_is_stop(A) (mp_type((A))>=mp_stop_clip_node_type) +# define mp_has_color(A) ((A)->type < mp_start_clip_node_type) +# define mp_has_script(A) ((A)->type <= mp_start_bounds_node_type) +# define mp_has_pen(A) ((A)->type <= mp_stroked_node_type) +# define mp_is_start_or_stop(A) ((A)->type >= mp_start_clip_node_type) +# define mp_is_stop(A) ((A)->type >= mp_stop_clip_node_type) # define mp_get_dash_list(A) (mp_dash_node) (((mp_dash_node) (A))->link) # define mp_set_dash_list(A,B) ((mp_dash_node) (A))->link = (mp_node) ((B)) # define mp_bblast(A) ((mp_edge_header_node) (A))->bblast @@ -413,7 +411,7 @@ if (mp_has_color(cp)) { \ break; \ } else { \ - cp = mp_link(cp); \ + cp = cp->link; \ } \ } \ } while (0) @@ -458,13 +456,13 @@ # define gr_dash_ptr(A) (A)->dash # define mp_gr_export_color(q,p) \ if (mp_color_model(p) == mp_uninitialized_model) { \ - gr_color_model(q) = number_to_scaled(internal_value(mp_default_color_model_internal))/65536; \ + gr_color_model(q) = (unsigned char) (number_to_scaled(internal_value(mp_default_color_model_internal))/65536); \ gr_cyan_val(q) = 0; \ gr_magenta_val(q) = 0; \ gr_yellow_val(q) = 0; \ gr_black_val(q) = gr_color_model(q) == mp_cmyk_model ? (number_to_scaled(unity_t)/65536.0) : 0; \ } else { \ - gr_color_model(q) = mp_color_model(p); \ + gr_color_model(q) = (unsigned char) mp_color_model(p); \ gr_cyan_val(q) = number_to_double(p->cyan); \ gr_magenta_val(q) = number_to_double(p->magenta); \ gr_yellow_val(q) = number_to_double(p->yellow); \ @@ -1655,7 +1653,7 @@ static void mp_free_node (MP mp, mp_node p, size_t siz) if (p->hasnumber == 2 && is_number(((mp_value_node) p)->subscript)) { free_number(((mp_value_node) p)->subscript); } - if (mp_type(p) == mp_dash_node_type) { + if (p->type == mp_dash_node_type) { free_number(((mp_dash_node) p)->start_x); free_number(((mp_dash_node) p)->stop_x); free_number(((mp_dash_node) p)->dash_y); @@ -2211,8 +2209,8 @@ static void mp_flush_token_list (MP mp, mp_node p) { while (p != NULL) { mp_node q = p; - p = mp_link(p); - switch (mp_type(q)) { + p = p->link; + switch (q->type) { case mp_symbol_node_type: mp_free_symbolic_node(mp, q); continue; @@ -2255,9 +2253,9 @@ void mp_show_token_list (MP mp, mp_node p, mp_node q) (void) q; while (p != NULL) { int c = mp_letter_class; - if (mp_type(p) != mp_symbol_node_type) { - if (mp_name_type(p) == mp_token_operation) { - if (mp_type(p) == mp_known_type) { + if (p->type != mp_symbol_node_type) { + if (p->name_type == mp_token_operation) { + if (p->type == mp_known_type) { if (cclass == mp_digit_class) { mp_print_chr(mp, ' '); } @@ -2273,7 +2271,7 @@ void mp_show_token_list (MP mp, mp_node p, mp_node q) print_number(mp_get_value_number(p)); c = mp_digit_class; } - } else if (mp_type(p) == mp_string_type) { + } else if (p->type == mp_string_type) { mp_print_chr(mp, '"'); mp_print_mp_str(mp, mp_get_value_str(p)); mp_print_chr(mp, '"'); @@ -2281,17 +2279,17 @@ void mp_show_token_list (MP mp, mp_node p, mp_node q) } else { mp_print_str(mp, " BAD"); } - } else if ((mp_name_type(p) != mp_capsule_operation) || (mp_type(p) < mp_vacuous_type) || (mp_type(p) > mp_independent_type)) { + } else if ((p->name_type != mp_capsule_operation) || (p->type < mp_vacuous_type) || (p->type > mp_independent_type)) { mp_print_str(mp, " BAD"); } else { mp_print_capsule(mp, p); c = mp_right_parenthesis_class; } - } else if (mp_name_type(p) == mp_expr_operation || mp_name_type(p) == mp_suffix_operation || mp_name_type(p) == mp_text_operation) { + } else if (p->name_type == mp_expr_operation || p->name_type == mp_suffix_operation || p->name_type == mp_text_operation) { int r = mp_get_sym_info(p); - if (mp_name_type(p) == mp_expr_operation) { + if (p->name_type == mp_expr_operation) { mp_print_str(mp, "(EXPR"); - } else if (mp_name_type(p) == mp_suffix_operation) { + } else if (p->name_type == mp_suffix_operation) { mp_print_str(mp, "(SUFFIX"); } else { mp_print_str(mp, "(TEXT"); @@ -2333,7 +2331,7 @@ void mp_show_token_list (MP mp, mp_node p, mp_node q) } } cclass = c; - p = mp_link(p); + p = p->link; } return; } @@ -2342,9 +2340,9 @@ void mp_show_token_list_space (MP mp, mp_node p, mp_node q) { (void) q; while (p != NULL) { - if (mp_type(p) != mp_symbol_node_type) { - if (mp_name_type(p) == mp_token_operation) { - if (mp_type(p) == mp_known_type) { + if (p->type != mp_symbol_node_type) { + if (p->name_type == mp_token_operation) { + if (p->type == mp_known_type) { if (number_negative(mp_get_value_number(p))) { mp_print_str(mp, "[ "); print_number(mp_get_value_number(p)); @@ -2352,23 +2350,23 @@ void mp_show_token_list_space (MP mp, mp_node p, mp_node q) } else { print_number(mp_get_value_number(p)); } - } else if (mp_type(p) == mp_string_type) { + } else if (p->type == mp_string_type) { mp_print_chr(mp, '"'); mp_print_mp_str(mp, mp_get_value_str(p)); mp_print_chr(mp, '"'); } else { mp_print_str(mp, "BAD"); } - } else if ((mp_name_type(p) != mp_capsule_operation) || (mp_type(p) < mp_vacuous_type) || (mp_type(p) > mp_independent_type)) { + } else if ((p->name_type != mp_capsule_operation) || (p->type < mp_vacuous_type) || (p->type > mp_independent_type)) { mp_print_str(mp, "BAD"); } else { mp_print_capsule(mp, p); } - } else if (mp_name_type(p) == mp_expr_operation || mp_name_type(p) == mp_suffix_operation || mp_name_type(p) == mp_text_operation) { + } else if (p->name_type == mp_expr_operation || p->name_type == mp_suffix_operation || p->name_type == mp_text_operation) { int r = mp_get_sym_info(p); - if (mp_name_type(p) == mp_expr_operation) { + if (p->name_type == mp_expr_operation) { mp_print_str(mp, "(EXPR "); - } else if (mp_name_type(p) == mp_suffix_operation) { + } else if (p->name_type == mp_suffix_operation) { mp_print_str(mp, "(SUFFIX "); } else { mp_print_str(mp, "(TEXT "); @@ -2388,7 +2386,7 @@ void mp_show_token_list_space (MP mp, mp_node p, mp_node q) } } } - p = mp_link(p); + p = p->link; if (p) { mp_print_chr(mp, ' '); } @@ -2407,12 +2405,12 @@ static void mp_delete_mac_ref (MP mp, mp_node p) static void mp_show_macro (MP mp, mp_node p, mp_node q) { - p = mp_link(p); - while (mp_name_type(p) != mp_macro_operation) { - mp_node r = mp_link(p); - mp_link(p) = NULL; + p = p->link; + while (p->name_type != mp_macro_operation) { + mp_node r = p->link; + p->link = NULL; mp_show_token_list(mp, p, NULL); - mp_link(p) = r; + p->link = r; p = r; } switch (mp_get_sym_info(p)) { @@ -2439,7 +2437,7 @@ static void mp_show_macro (MP mp, mp_node p, mp_node q) mp_print_str(mp, "<text> -> "); break; } - mp_show_token_list(mp, mp_link(p), q); + mp_show_token_list(mp, p->link, q); } static mp_node mp_do_get_attribute_head (MP mp, mp_value_node A) @@ -2480,7 +2478,7 @@ static mp_node mp_new_value_node (MP mp) new_number(p->subscript); p->hasnumber = 2; } - mp_type(p) = mp_value_node_type; + p->type = mp_value_node_type; return (mp_node) p; } @@ -2492,14 +2490,14 @@ static mp_node mp_new_value_node (MP mp) static mp_value_node mp_get_attribute_node (MP mp) { mp_value_node p = (mp_value_node) mp_new_value_node(mp); - mp_type(p) = mp_attribute_node_type; + p->type = mp_attribute_node_type; return p; } static mp_value_node mp_get_subscr_node (MP mp) { mp_value_node p = (mp_value_node) mp_new_value_node(mp); - mp_type(p) = mp_subscript_node_type; + p->type = mp_subscript_node_type; return p; } @@ -2514,7 +2512,7 @@ static mp_node mp_get_pair_node (MP mp) } else { p = mp_allocate_node(mp, sizeof(mp_pair_node_data)); } - mp_type(p) = mp_pair_node_type; + p->type = mp_pair_node_type; return (mp_node) p; } @@ -2535,97 +2533,96 @@ static void mp_free_pair_node (MP mp, mp_node p) static void mp_init_pair_node (MP mp, mp_node p) { mp_node q; - mp_type(p) = mp_pair_type; + p->type = mp_pair_type; q = mp_get_pair_node(mp); mp_y_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_y_part(q)); - mp_name_type(mp_y_part(q)) = mp_y_part_operation; - mp_link(mp_y_part(q)) = p; + mp_y_part(q)->name_type = mp_y_part_operation; + mp_y_part(q)->link = p; mp_x_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_x_part(q)); - mp_name_type(mp_x_part(q)) = mp_x_part_operation; - mp_link(mp_x_part(q)) = p; + mp_x_part(q)->name_type = mp_x_part_operation; + mp_x_part(q)->link = p; mp_set_value_node(p, q); } static mp_node mp_get_transform_node (MP mp) { mp_transform_node p = (mp_transform_node) mp_allocate_node(mp, sizeof(mp_transform_node_data)); - mp_type(p) = mp_transform_node_type; + p->type = mp_transform_node_type; return (mp_node) p; } static void mp_init_transform_node (MP mp, mp_node p) { mp_node q; - mp_type(p) = mp_transform_type; + p->type = mp_transform_type; q = mp_get_transform_node(mp); mp_yy_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_yy_part(q)); - mp_name_type(mp_yy_part(q)) = mp_yy_part_operation; - mp_link(mp_yy_part(q)) = p; + mp_yy_part(q)->name_type = mp_yy_part_operation; + mp_yy_part(q)->link = p; mp_yx_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_yx_part(q)); - mp_name_type(mp_yx_part(q)) = mp_yx_part_operation; - mp_link(mp_yx_part(q)) = p; + mp_yx_part(q)->name_type = mp_yx_part_operation; + mp_yx_part(q)->link = p; mp_xy_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_xy_part(q)); - mp_name_type(mp_xy_part(q)) = mp_xy_part_operation; - mp_link(mp_xy_part(q)) = p; + mp_xy_part(q)->name_type = mp_xy_part_operation; + mp_xy_part(q)->link = p; mp_xx_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_xx_part(q)); - mp_name_type(mp_xx_part(q)) = mp_xx_part_operation; - mp_link(mp_xx_part(q)) = p; + mp_xx_part(q)->name_type = mp_xx_part_operation; + mp_xx_part(q)->link = p; mp_ty_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_ty_part(q)); - mp_name_type(mp_ty_part(q)) = mp_y_part_operation; - mp_link(mp_ty_part(q)) = p; + mp_ty_part(q)->name_type = mp_y_part_operation; + mp_ty_part(q)->link = p; mp_tx_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_tx_part(q)); - mp_name_type(mp_tx_part(q)) = mp_x_part_operation; - mp_link(mp_tx_part(q)) = p; + mp_tx_part(q)->name_type = mp_x_part_operation; + mp_tx_part(q)->link = p; mp_set_value_node(p, q); } static void mp_init_color_node (MP mp, mp_node p, int type) { mp_node q = (mp_node) mp_allocate_node(mp, sizeof(mp_color_node_data)); - q->link = NULL; - mp_type(p) = type; + p->type = type; switch (type) { case mp_color_type: - mp_type(q) = mp_color_node_type; + q->type = mp_color_node_type; mp_red_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_red_part(q)); - mp_name_type(mp_red_part(q)) = mp_red_part_operation; - mp_link(mp_red_part(q)) = p; + mp_red_part(q)->name_type = mp_red_part_operation; + mp_red_part(q)->link = p; mp_green_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_green_part(q)); - mp_name_type(mp_green_part(q)) = mp_green_part_operation; - mp_link(mp_green_part(q)) = p; + mp_green_part(q)->name_type = mp_green_part_operation; + mp_green_part(q)->link = p; mp_blue_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_blue_part(q)); - mp_name_type(mp_blue_part(q)) = mp_blue_part_operation; - mp_link(mp_blue_part(q)) = p; + mp_blue_part(q)->name_type = mp_blue_part_operation; + mp_blue_part(q)->link = p; break; case mp_cmykcolor_type: - mp_type(q) = mp_cmykcolor_node_type; + q->type = mp_cmykcolor_node_type; mp_cyan_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_cyan_part(q)); - mp_name_type(mp_cyan_part(q)) = mp_cyan_part_operation; - mp_link(mp_cyan_part(q)) = p; + mp_cyan_part(q)->name_type = mp_cyan_part_operation; + mp_cyan_part(q)->link = p; mp_magenta_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_magenta_part(q)); - mp_name_type(mp_magenta_part(q)) = mp_magenta_part_operation; - mp_link(mp_magenta_part(q)) = p; + mp_magenta_part(q)->name_type = mp_magenta_part_operation; + mp_magenta_part(q)->link = p; mp_yellow_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_yellow_part(q)); - mp_name_type(mp_yellow_part(q)) = mp_yellow_part_operation; - mp_link(mp_yellow_part(q)) = p; + mp_yellow_part(q)->name_type = mp_yellow_part_operation; + mp_yellow_part(q)->link = p; mp_black_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_black_part(q)); - mp_name_type(mp_black_part(q)) = mp_black_part_operation; - mp_link(mp_black_part(q)) = p; + mp_black_part(q)->name_type = mp_black_part_operation; + mp_black_part(q)->link = p; break; } mp_set_value_node(p, q); @@ -2635,21 +2632,21 @@ static mp_node mp_id_transform (MP mp) { mp_node q; mp_node p = mp_new_value_node(mp); - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp_set_value_number(p, zero_t); mp_init_transform_node(mp, p); q = mp_get_value_node(p); - mp_type(mp_tx_part(q)) = mp_known_type; + mp_tx_part(q)->type = mp_known_type; mp_set_value_number(mp_tx_part(q), zero_t); - mp_type(mp_ty_part(q)) = mp_known_type; + mp_ty_part(q)->type = mp_known_type; mp_set_value_number(mp_ty_part(q), zero_t); - mp_type(mp_xy_part(q)) = mp_known_type; + mp_xy_part(q)->type = mp_known_type; mp_set_value_number(mp_xy_part(q), zero_t); - mp_type(mp_yx_part(q)) = mp_known_type; + mp_yx_part(q)->type = mp_known_type; mp_set_value_number(mp_yx_part(q), zero_t); - mp_type(mp_xx_part(q)) = mp_known_type; + mp_xx_part(q)->type = mp_known_type; mp_set_value_number(mp_xx_part(q), unity_t); - mp_type(mp_yy_part(q)) = mp_known_type; + mp_yy_part(q)->type = mp_known_type; mp_set_value_number(mp_yy_part(q), unity_t); return p; } @@ -2657,8 +2654,8 @@ static mp_node mp_id_transform (MP mp) static void mp_new_root (MP mp, mp_sym x) { mp_node p = mp_new_value_node(mp); - mp_type(p) = mp_undefined_type; - mp_name_type(p) = mp_root_operation; + p->type = mp_undefined_type; + p->name_type = mp_root_operation; mp_set_value_sym(p, x); set_equiv_node(x, p); } @@ -2667,8 +2664,8 @@ void mp_print_variable_name (MP mp, mp_node p) { mp_node q = NULL; mp_node r = NULL; - while (mp_name_type(p) >= mp_x_part_operation) { - switch (mp_name_type(p)) { + while (p->name_type >= mp_x_part_operation) { + switch (p->name_type) { case mp_x_part_operation : mp_print_str(mp, "xpart "); break; case mp_y_part_operation : mp_print_str(mp, "ypart "); break; case mp_xx_part_operation : mp_print_str(mp, "xxpart "); break; @@ -2686,18 +2683,18 @@ void mp_print_variable_name (MP mp, mp_node p) case mp_capsule_operation : mp_print_fmt(mp, "%%CAPSULE%p", p); return; default : break; } - p = mp_link(p); + p = p->link; } - while (mp_name_type(p) > mp_saved_root_operation) { - if (mp_name_type(p) == mp_subscript_operation) { + while (p->name_type > mp_saved_root_operation) { + if (p->name_type == mp_subscript_operation) { r = mp_new_num_tok(mp, &(mp_subscript(p))); do { - p = mp_link(p); - } while (mp_name_type(p) != mp_attribute_operation); - } else if (mp_name_type(p) == mp_structured_root_operation) { - p = mp_link(p); + p = p->link; + } while (p->name_type != mp_attribute_operation); + } else if (p->name_type == mp_structured_root_operation) { + p = p->link; goto FOUND; - } else if (mp_name_type(p) != mp_attribute_operation) { + } else if (p->name_type != mp_attribute_operation) { mp_confusion(mp, "variable"); } else { r = mp_new_symbolic_node(mp); @@ -2710,8 +2707,8 @@ void mp_print_variable_name (MP mp, mp_node p) } r = mp_new_symbolic_node(mp); mp_set_sym_sym(r, mp_get_value_sym(p)); - mp_link(r) = q; - if (mp_name_type(p) == mp_saved_root_operation) { + r->link = q; + if (p->name_type == mp_saved_root_operation) { mp_print_str(mp, "(SAVED)"); } mp_show_token_list(mp, r, NULL); @@ -2723,25 +2720,25 @@ static int mp_interesting (MP mp, mp_node p) if (number_positive(internal_value(mp_tracing_capsules_internal))) { return 1; } else { - mp_name_type_type t = mp_name_type(p); + mp_name_type_type t = p->name_type; if (t >= mp_x_part_operation && t != mp_capsule_operation) { - mp_node tt = mp_get_value_node(mp_link(p)); + mp_node tt = mp_get_value_node(p->link); switch (t) { - case mp_x_part_operation: t = mp_name_type(mp_x_part (tt)); break; - case mp_y_part_operation: t = mp_name_type(mp_y_part (tt)); break; - case mp_xx_part_operation: t = mp_name_type(mp_xx_part (tt)); break; - case mp_xy_part_operation: t = mp_name_type(mp_xy_part (tt)); break; - case mp_yx_part_operation: t = mp_name_type(mp_yx_part (tt)); break; - case mp_yy_part_operation: t = mp_name_type(mp_yy_part (tt)); break; - case mp_red_part_operation: t = mp_name_type(mp_red_part (tt)); break; - case mp_green_part_operation: t = mp_name_type(mp_green_part (tt)); break; - case mp_blue_part_operation: t = mp_name_type(mp_blue_part (tt)); break; - case mp_cyan_part_operation: t = mp_name_type(mp_cyan_part (tt)); break; - case mp_magenta_part_operation: t = mp_name_type(mp_magenta_part(tt)); break; - case mp_yellow_part_operation: t = mp_name_type(mp_yellow_part (tt)); break; - case mp_black_part_operation: t = mp_name_type(mp_black_part (tt)); break; - case mp_grey_part_operation: t = mp_name_type(mp_grey_part (tt)); break; - default: break; + case mp_x_part_operation: t = mp_x_part (tt)->name_type; break; + case mp_y_part_operation: t = mp_y_part (tt)->name_type; break; + case mp_xx_part_operation: t = mp_xx_part (tt)->name_type; break; + case mp_xy_part_operation: t = mp_xy_part (tt)->name_type; break; + case mp_yx_part_operation: t = mp_yx_part (tt)->name_type; break; + case mp_yy_part_operation: t = mp_yy_part (tt)->name_type; break; + case mp_red_part_operation: t = mp_red_part (tt)->name_type; break; + case mp_green_part_operation: t = mp_green_part (tt)->name_type; break; + case mp_blue_part_operation: t = mp_blue_part (tt)->name_type; break; + case mp_cyan_part_operation: t = mp_cyan_part (tt)->name_type; break; + case mp_magenta_part_operation: t = mp_magenta_part(tt)->name_type; break; + case mp_yellow_part_operation: t = mp_yellow_part (tt)->name_type; break; + case mp_black_part_operation: t = mp_black_part (tt)->name_type; break; + case mp_grey_part_operation: t = mp_grey_part (tt)->name_type; break; + default: break; } } return (t != mp_capsule_operation); @@ -2751,7 +2748,7 @@ static int mp_interesting (MP mp, mp_node p) static mp_node mp_new_structure (MP mp, mp_node p) { mp_node r = NULL; - switch (mp_name_type(p)) { + switch (p->name_type) { case mp_root_operation: { mp_sym q = mp_get_value_sym(p); @@ -2764,14 +2761,14 @@ static mp_node mp_new_structure (MP mp, mp_node p) mp_node q_new; mp_node q = p; do { - q = mp_link(q); - } while (mp_name_type(q) != mp_attribute_operation); + q = q->link; + } while (q->name_type != mp_attribute_operation); q = mp_get_parent((mp_value_node) q); r = mp->temp_head; mp_set_link(r, mp_get_subscr_head(q)); do { q_new = r; - r = mp_link(r); + r = r->link; } while (r != p); r = (mp_node) mp_get_subscr_node(mp); if (q_new == mp->temp_head) { @@ -2789,7 +2786,7 @@ static mp_node mp_new_structure (MP mp, mp_node p) r = mp_get_attribute_head(q); do { q = r; - r = mp_link(r); + r = r->link; } while (r != p); rr = mp_get_attribute_node(mp); r = (mp_node) rr; @@ -2799,8 +2796,8 @@ static mp_node mp_new_structure (MP mp, mp_node p) if (mp_get_hashloc(p) == mp_collective_subscript) { q = mp->temp_head; mp_set_link(q, mp_get_subscr_head(mp_get_parent((mp_value_node) p))); - while (mp_link(q) != p) { - q = mp_link(q); + while (q->link != p) { + q = q->link; } if (q == mp->temp_head) { mp_set_subscr_head(mp_get_parent((mp_value_node) p), (mp_node) rr); @@ -2816,18 +2813,18 @@ static mp_node mp_new_structure (MP mp, mp_node p) } if (r) { mp_value_node q; - mp_set_link(r, mp_link(p)); + mp_set_link(r, p->link); mp_set_value_sym(r, mp_get_value_sym(p)); - mp_type(r) = mp_structured_type; - mp_name_type(r) = mp_name_type(p); + r->type = mp_structured_type; + r->name_type = p->name_type; mp_set_attribute_head(r, p); - mp_name_type(p) = mp_structured_root_operation; + p->name_type = mp_structured_root_operation; q = mp_get_attribute_node(mp); mp_set_link(p, q); mp_set_subscr_head(r, (mp_node) q); mp_set_parent(q, r); - mp_type(q) = mp_undefined_type; - mp_name_type(q) = mp_attribute_operation; + q->type = mp_undefined_type; + q->name_type = mp_attribute_operation; mp_set_link(q, mp->end_attr); mp_set_hashloc(q, mp_collective_subscript); } @@ -2843,15 +2840,15 @@ static mp_node mp_find_variable (MP mp, mp_node t) } else { mp_node p, q, r, s; mp_node pp, qq, rr, ss; - t = mp_link(t); + t = t->link; if (equiv_node(p_sym) == NULL) { mp_new_root (mp, p_sym); } p = equiv_node(p_sym); pp = p; while (t != NULL) { - if (mp_type(pp) != mp_structured_type) { - if (mp_type(pp) > mp_structured_type) { + if (pp->type != mp_structured_type) { + if (pp->type > mp_structured_type) { return NULL; } else { ss = mp_new_structure(mp, pp); @@ -2861,21 +2858,21 @@ static mp_node mp_find_variable (MP mp, mp_node t) pp = ss; } } - if (mp_type(p) != mp_structured_type) { + if (p->type != mp_structured_type) { p = mp_new_structure(mp, p); } - if (mp_type(t) != mp_symbol_node_type) { + if (t->type != mp_symbol_node_type) { mp_number nn, save_subscript; new_number_clone(nn, mp_get_value_number(t)); - pp = mp_link(mp_get_attribute_head(pp)); - q = mp_link(mp_get_attribute_head(p)); + pp = mp_get_attribute_head(pp)->link; + q = mp_get_attribute_head(p)->link; new_number_clone(save_subscript, mp_subscript(q)); set_number_to_inf(mp_subscript(q)); s = mp->temp_head; mp_set_link(s, mp_get_subscr_head(p)); do { r = s; - s = mp_link(s); + s = s->link; } while (number_greater(nn, mp_subscript(s))); if (number_equal(nn, mp_subscript(s))) { p = s; @@ -2888,8 +2885,8 @@ static mp_node mp_find_variable (MP mp, mp_node t) } mp_set_link(p1, s); number_clone(mp_subscript(p1), nn); - mp_name_type(p1) = mp_subscript_operation; - mp_type(p1) = mp_undefined_type; + p1->name_type = mp_subscript_operation; + p1->type = mp_undefined_type; p = (mp_node) p1; } number_clone(mp_subscript(q), save_subscript); @@ -2900,15 +2897,15 @@ static mp_node mp_find_variable (MP mp, mp_node t) ss = mp_get_attribute_head(pp); do { rr = ss; - ss = mp_link(ss); + ss = ss->link; } while (nn1 > mp_get_hashloc(ss)); if (nn1 < mp_get_hashloc(ss)) { qq = (mp_node) mp_get_attribute_node(mp); mp_set_link(rr, qq); mp_set_link(qq, ss); mp_set_hashloc(qq, nn1); - mp_name_type(qq) = mp_attribute_operation; - mp_type(qq) = mp_undefined_type; + qq->name_type = mp_attribute_operation; + qq->type = mp_undefined_type; mp_set_parent((mp_value_node) qq, pp); ss = qq; } @@ -2920,7 +2917,7 @@ static mp_node mp_find_variable (MP mp, mp_node t) s = mp_get_attribute_head(p); do { r = s; - s = mp_link(s); + s = s->link; } while (nn1 > mp_get_hashloc(s)); if (nn1 == mp_get_hashloc(s)) { p = s; @@ -2929,31 +2926,31 @@ static mp_node mp_find_variable (MP mp, mp_node t) mp_set_link(r, q); mp_set_link(q, s); mp_set_hashloc(q, nn1); - mp_name_type(q) = mp_attribute_operation; - mp_type(q) = mp_undefined_type; + q->name_type = mp_attribute_operation; + q->type = mp_undefined_type; mp_set_parent((mp_value_node) q, p); p = q; } } } - t = mp_link(t); + t = t->link; } - if (mp_type(pp) >= mp_structured_type) { - if (mp_type(pp) == mp_structured_type) { + if (pp->type >= mp_structured_type) { + if (pp->type == mp_structured_type) { pp = mp_get_attribute_head(pp); } else { return NULL; } } - if (mp_type(p) == mp_structured_type) { + if (p->type == mp_structured_type) { p = mp_get_attribute_head(p); } - if (mp_type(p) == mp_undefined_type) { - if (mp_type(pp) == mp_undefined_type) { - mp_type(pp) = mp_numeric_type; + if (p->type == mp_undefined_type) { + if (pp->type == mp_undefined_type) { + pp->type = mp_numeric_type; mp_set_value_number(pp, zero_t); } - mp_type(p) = mp_type(pp); + p->type = pp->type; mp_set_value_number(p, zero_t); } return p; @@ -2963,34 +2960,34 @@ static mp_node mp_find_variable (MP mp, mp_node t) static void mp_flush_variable (MP mp, mp_node p, mp_node t, int discard_suffixes) { while (t != NULL) { - if (mp_type(p) != mp_structured_type) { + if (p->type != mp_structured_type) { return; } else { mp_sym n = mp_get_sym_sym(t); - t = mp_link(t); + t = t->link; if (n == mp_collective_subscript) { mp_node q = mp_get_subscr_head(p); mp_node r = NULL; - while (mp_name_type(q) == mp_subscript_operation) { + while (q->name_type == mp_subscript_operation) { mp_flush_variable(mp, q, t, discard_suffixes); if (t != NULL) { r = q; - } else if (mp_type(q) == mp_structured_type) { + } else if (q->type == mp_structured_type) { r = q; } else { if (r == NULL) { - mp_set_subscr_head(p, mp_link(q)); + mp_set_subscr_head(p, q->link); } else { - mp_set_link(r, mp_link(q)); + mp_set_link(r, q->link); } mp_free_value_node(mp, q); } - q = r == NULL ? mp_get_subscr_head(p) : mp_link(r); + q = r == NULL ? mp_get_subscr_head(p) : r->link; } } p = mp_get_attribute_head(p); do { - p = mp_link(p); + p = p->link; } while (mp_get_hashloc(p) < n); if (mp_get_hashloc(p) != n) { return; @@ -3000,7 +2997,7 @@ static void mp_flush_variable (MP mp, mp_node p, mp_node t, int discard_suffixes if (discard_suffixes) { mp_flush_below_variable(mp, p); } else { - if (mp_type(p) == mp_structured_type) { + if (p->type == mp_structured_type) { p = mp_get_attribute_head(p); } mp_recycle_value(mp, p); @@ -3009,35 +3006,35 @@ static void mp_flush_variable (MP mp, mp_node p, mp_node t, int discard_suffixes void mp_flush_below_variable (MP mp, mp_node p) { - if (mp_type(p) != mp_structured_type) { + if (p->type != mp_structured_type) { mp_recycle_value(mp, p); } else { mp_node r; mp_node q = mp_get_subscr_head(p); - while (mp_name_type(q) == mp_subscript_operation) { + while (q->name_type == mp_subscript_operation) { mp_flush_below_variable(mp, q); r = q; - q = mp_link(q); + q = q->link; mp_free_value_node(mp, r); } r = mp_get_attribute_head(p); - q = mp_link(r); + q = r->link; mp_recycle_value(mp, r); mp_free_value_node(mp, r); do { mp_flush_below_variable(mp, q); r = q; - q = mp_link(q); + q = q->link; mp_free_value_node(mp, r); } while (q != mp->end_attr); - mp_type(p) = mp_undefined_type; + p->type = mp_undefined_type; } } static int mp_und_type (MP mp, mp_node p) { (void) mp; - switch (mp_type(p)) { + switch (p->type) { case mp_vacuous_type: return mp_undefined_type; case mp_boolean_type: @@ -3063,7 +3060,7 @@ static int mp_und_type (MP mp, mp_node p) case mp_cmykcolor_type: case mp_pair_type: case mp_numeric_type: - return mp_type(p); + return p->type; case mp_known_type: case mp_dependent_type: case mp_proto_dependent_type: @@ -3092,7 +3089,7 @@ static void mp_clear_symbol (MP mp, mp_sym p, int saving) case mp_tag_command: if (q != NULL) { if (saving) { - mp_name_type(q) = mp_saved_root_operation; + q->name_type = mp_saved_root_operation; } else { mp_flush_below_variable(mp, q); mp_free_value_node(mp, q); @@ -3147,7 +3144,7 @@ static void mp_unsave_variable (MP mp) if (eq_type(q) == mp_tag_command) { mp_node pp = q->v.data.node; if (pp != NULL) { - mp_name_type(pp) = mp_root_operation; + pp->name_type = mp_root_operation; } } } @@ -5809,9 +5806,9 @@ void mp_move_knot (MP mp, mp_knot p, mp_knot q) static void mp_find_offset (MP mp, mp_number *x_orig, mp_number *y_orig, mp_knot h) { if (mp_pen_is_elliptical(h)) { - mp_fraction xx, yy; + mp_number xx, yy; mp_number wx, wy, hx, hy; - mp_fraction d; + mp_number d; new_fraction(xx); new_fraction(yy); new_number(wx); @@ -5970,7 +5967,7 @@ static void mp_pen_bbox (MP mp, mp_knot h) static mp_node mp_new_shape_node (MP mp, mp_knot p, int type) { mp_shape_node t = mp_allocate_node(mp, sizeof(mp_shape_node_data)); - mp_type(t) = type; + t->type = type; mp_path_ptr(t) = p; mp_pen_ptr(t) = NULL; mp_dash_ptr(t) = NULL; @@ -6114,9 +6111,8 @@ static mp_node mp_new_bounds_node (MP mp, mp_knot p, int c) case mp_start_bounds_node_type: { mp_start_node t = (mp_start_node) mp_allocate_node(mp, sizeof(mp_start_node_data)); - mp_type(t) = c; + t->type = c; t->path = p; - t->link = NULL; t->stacking = round_unscaled(internal_value(mp_stacking_internal)); mp_pre_script(t) = NULL; mp_post_script(t) = NULL; @@ -6128,8 +6124,7 @@ static mp_node mp_new_bounds_node (MP mp, mp_knot p, int c) case mp_stop_bounds_node_type: { mp_stop_node t = (mp_stop_node) mp_allocate_node(mp, sizeof(mp_stop_node_data)); - mp_type(t) = c; - t->link = NULL; + t->type = c; t->stacking = round_unscaled(internal_value(mp_stacking_internal)); return (mp_node) t; } @@ -6164,7 +6159,7 @@ static mp_dash_node mp_get_dash_node (MP mp) new_number(p->start_x); new_number(p->stop_x); new_number(p->dash_y); - mp_type(p) = mp_dash_node_type; + p->type = mp_dash_node_type; return p; } @@ -6182,7 +6177,7 @@ static void mp_init_bbox (MP mp, mp_edge_header_node h) static mp_edge_header_node mp_get_edge_header_node (MP mp) { mp_edge_header_node p = (mp_edge_header_node) mp_allocate_node(mp, sizeof(mp_edge_header_node_data)); - mp_type(p) = mp_edge_header_node_type; + p->type = mp_edge_header_node_type; new_number(p->start_x); new_number(p->stop_x); new_number(p->dash_y); @@ -6198,7 +6193,7 @@ static void mp_init_edges (MP mp, mp_edge_header_node h) { mp_set_dash_list(h, mp->null_dash); mp_obj_tail(h) = mp_edge_list(h); - mp_link(mp_edge_list(h)) = NULL; + mp_edge_list(h)->link = NULL; mp_edge_ref_count(h) = 0; mp_init_bbox(mp, h); } @@ -6208,10 +6203,10 @@ void mp_toss_edges (MP mp, mp_edge_header_node h) mp_node q; mp_edge_header_node r; mp_flush_dash_list(mp, h); - q = mp_link(mp_edge_list(h)); + q = mp_edge_list(h)->link; while (q != NULL) { mp_node p = q; - q = mp_link(q); + q = q->link; r = mp_toss_gr_object(mp, p); if (r != NULL) { mp_delete_edge_ref(mp, r); @@ -6233,7 +6228,7 @@ void mp_flush_dash_list (MP mp, mp_edge_header_node h) mp_dash_node q = mp_get_dash_list(h); while (q != mp->null_dash) { mp_dash_node p = q; - q = (mp_dash_node) mp_link(q); + q = (mp_dash_node) q->link; mp_free_node(mp, (mp_node) p, sizeof(mp_dash_node_data)); } mp_set_dash_list(h, mp->null_dash); @@ -6241,7 +6236,7 @@ void mp_flush_dash_list (MP mp, mp_edge_header_node h) mp_edge_header_node mp_toss_gr_object (MP mp, mp_node p) { - switch (mp_type(p)) { + switch (p->type) { case mp_fill_node_type: case mp_stroked_node_type: return mp_free_shape_node(mp, (mp_shape_node) p); @@ -6268,17 +6263,17 @@ static mp_edge_header_node mp_private_edges (MP mp, mp_edge_header_node h) mp_edge_header_node hh; mp_dash_node p, pp; mp_edge_ref_count(h) -= 1; - hh = (mp_edge_header_node) mp_copy_objects (mp, mp_link(mp_edge_list(h)), NULL); + hh = (mp_edge_header_node) mp_copy_objects (mp, mp_edge_list(h)->link, NULL); pp = (mp_dash_node) hh; p = mp_get_dash_list(h); while ((p != mp->null_dash)) { - mp_link(pp) = (mp_node) mp_get_dash_node(mp); - pp = (mp_dash_node) mp_link(pp); + pp->link = (mp_node) mp_get_dash_node(mp); + pp = (mp_dash_node) pp->link; number_clone(pp->start_x, p->start_x); number_clone(pp->stop_x, p->stop_x); - p = (mp_dash_node) mp_link(p); + p = (mp_dash_node) p->link; } - mp_link(pp) = (mp_node) mp->null_dash; + pp->link = (mp_node) mp->null_dash; number_clone(hh->dash_y, h->dash_y); number_clone(hh->minx, h->minx); @@ -6292,8 +6287,8 @@ static mp_edge_header_node mp_private_edges (MP mp, mp_edge_header_node h) if (p == NULL) { mp_confusion(mp, "boundingbox last"); } else { - p = (mp_dash_node) mp_link(p); - pp = (mp_dash_node) mp_link(pp); + p = (mp_dash_node) p->link; + pp = (mp_dash_node) pp->link; } } mp_bblast(hh) = (mp_node) pp; @@ -6344,12 +6339,12 @@ static mp_dash_object *mp_export_dashes (MP mp, mp_shape_node q, mp_number *w) set_number_from_subtraction(arg1, p->stop_x, p->start_x); take_scaled(ret, arg1, scf); dashes[(num_dashes - 1)] = number_to_double(ret); - set_number_from_subtraction(arg1, ((mp_dash_node) mp_link(p))->start_x, p->stop_x); + set_number_from_subtraction(arg1, ((mp_dash_node) p->link)->start_x, p->stop_x); take_scaled(ret, arg1, scf); dashes[(num_dashes)] = number_to_double(ret); dashes[(num_dashes + 1)] = -1.0; num_dashes += 2; - p = (mp_dash_node) mp_link(p); + p = (mp_dash_node) p->link; } d->array = dashes; mp_dash_offset(mp, &dashoff, h); @@ -6373,7 +6368,7 @@ mp_edge_header_node mp_copy_objects (MP mp, mp_node p, mp_node q) { pp = mp_edge_list(hh); while (p != q) { { - switch (mp_type(p)) { + switch (p->type) { case mp_fill_node_type: case mp_stroked_node_type: k = sizeof(mp_shape_node_data); @@ -6391,11 +6386,11 @@ mp_edge_header_node mp_copy_objects (MP mp, mp_node p, mp_node q) { default: break; } - mp_link(pp) = mp_allocate_node(mp, (size_t) k); - pp = mp_link(pp); + pp->link = mp_allocate_node(mp, (size_t) k); + pp = pp->link; memcpy(pp, p, (size_t) k); pp->link = NULL; - switch (mp_type(p)) { + switch (p->type) { case mp_fill_node_type: case mp_stroked_node_type: { @@ -6444,11 +6439,11 @@ mp_edge_header_node mp_copy_objects (MP mp, mp_node p, mp_node q) { default: break; } - p = mp_link(p); + p = p->link; } } mp_obj_tail(hh) = pp; - mp_link(pp) = NULL; + pp->link = NULL; return hh; } @@ -6464,7 +6459,7 @@ static mp_node mp_skip_1component (MP mp, mp_node p) ++lev; } } - p = mp_link(p); + p = p->link; } while (lev != 0); return p; } @@ -6475,10 +6470,10 @@ void mp_print_edges (MP mp, mp_node h, const char *s, int nuline) mp_number scf; new_number(scf); mp_print_diagnostic(mp, "Edge structure", s, nuline); - while (mp_link(p) != NULL) { - p = mp_link(p); + while (p->link != NULL) { + p = p->link; mp_print_ln(mp); - switch (mp_type(p)) { + switch (p->type) { case mp_fill_node_type: mp_print_str(mp, "Filled contour "); mp_print_obj_color (mp, p); @@ -6539,10 +6534,10 @@ void mp_print_edges (MP mp, mp_node h, const char *s, int nuline) take_scaled(ret, arg1, scf); print_number( ret); mp_print_str(mp, " off "); - set_number_from_subtraction(arg1, ((mp_dash_node) mp_link(ppd))->start_x, ppd->stop_x); + set_number_from_subtraction(arg1, ((mp_dash_node) ppd->link)->start_x, ppd->stop_x); take_scaled(ret, arg1, scf); print_number(ret); - ppd = (mp_dash_node) mp_link(ppd); + ppd = (mp_dash_node) ppd->link; if (ppd != mp->null_dash) { mp_print_chr(mp, ' '); } @@ -6711,9 +6706,9 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) new_number(y0); p0 = NULL; - p = mp_link(mp_edge_list(h)); + p = mp_edge_list(h)->link; while (p != NULL) { - if (mp_type(p) != mp_stroked_node_type) { + if (p->type != mp_stroked_node_type) { mp_back_error( mp, "Picture is too complicated to use as a dash pattern", @@ -6812,17 +6807,17 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) } number_clone(mp->null_dash->start_x, d->stop_x); dd = (mp_dash_node) h; - while (number_less(((mp_dash_node) mp_link(dd))->start_x, d->stop_x)) { - dd = (mp_dash_node) mp_link(dd); + while (number_less(((mp_dash_node) dd->link)->start_x, d->stop_x)) { + dd = (mp_dash_node) dd->link; } if ((dd != (mp_dash_node) h) && number_greater(dd->stop_x, d->start_x)) { mp_x_retrace_error(mp); goto NOT_FOUND; } - mp_link(d) = mp_link(dd); - mp_link(dd) = (mp_node) d; + d->link = dd->link; + dd->link = (mp_node) d; - p = mp_link(p); + p = p->link; } if (mp_get_dash_list(h) == mp->null_dash) { goto NOT_FOUND; @@ -6831,10 +6826,10 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) mp_number hsf; new_number(hsf); d = (mp_dash_node) h; - while (mp_link(d) != (mp_node) mp->null_dash) { - ds = mp_dash_info(mp_link(d)); + while (d->link != (mp_node) mp->null_dash) { + ds = mp_dash_info(d->link); if (ds == NULL) { - d = (mp_dash_node) mp_link(d); + d = (mp_dash_node) d->link; } else { hh = (mp_edge_header_node) mp_dash_ptr(ds); number_clone(hsf, ((mp_shape_node) ds)->dashscale); @@ -6842,7 +6837,7 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) mp_confusion(mp, "dash pattern"); return NULL; } else if (number_zero(((mp_dash_node) hh)->dash_y )) { - d = (mp_dash_node) mp_link(d); + d = (mp_dash_node) d->link; } else if (mp_get_dash_list (hh) == NULL) { mp_confusion(mp, "dash list"); return NULL; @@ -6852,7 +6847,7 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) mp_number r1, r2; new_number(r1); new_number(r2); - dln = (mp_dash_node) mp_link(d); + dln = (mp_dash_node) d->link; dd = mp_get_dash_list(hh); new_number(xoff); new_number(dashoff); @@ -6872,7 +6867,7 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) take_scaled(r1, hsf, dd->stop_x); number_add(r1, xoff); while (number_less(r1, dln->start_x)) { - dd = (mp_dash_node) mp_link(dd); + dd = (mp_dash_node) dd->link; take_scaled(r1, hsf, dd->stop_x); number_add(r1, xoff); } @@ -6893,9 +6888,9 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) take_scaled(r1, hsf, dd->start_x); number_add(r1, xoff); if (number_lessequal(r1, dln->stop_x)) { - mp_link(d) = (mp_node) mp_get_dash_node(mp); - d = (mp_dash_node) mp_link(d); - mp_link(d) = (mp_node) dln; + d->link = (mp_node) mp_get_dash_node(mp); + d = (mp_dash_node) d->link; + d->link = (mp_node) dln; take_scaled(r1, hsf, dd->start_x ); number_add(r1, xoff); if (number_greater(dln->start_x, r1)) { @@ -6913,14 +6908,14 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) } free_number(r1); } - dd = (mp_dash_node) mp_link(dd); + dd = (mp_dash_node) dd->link; take_scaled(r1, hsf, dd->start_x); set_number_from_addition(dln->start_x , xoff, r1); } free_number(xoff); free_number(r1); free_number(r2); - mp_link(d) = mp_link(dln); + d->link = dln->link; mp_free_node(mp, (mp_node) dln, sizeof(mp_dash_node_data)); } } @@ -6928,8 +6923,8 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) free_number(hsf); } d = mp_get_dash_list(h); - while (mp_link(d) != (mp_node) mp->null_dash) { - d = (mp_dash_node) mp_link(d); + while (d->link != (mp_node) mp->null_dash) { + d = (mp_dash_node) d->link; } dd = mp_get_dash_list(h); set_number_from_subtraction(h->dash_y, d->stop_x, dd->start_x); @@ -6940,7 +6935,7 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) if (number_greater(absval, h->dash_y) ) { number_clone(h->dash_y, absval); } else if (d != dd) { - mp_set_dash_list(h, mp_link(dd)); + mp_set_dash_list(h, dd->link); set_number_from_addition(d->stop_x, dd->stop_x, h->dash_y); mp_free_node(mp, (mp_node) dd, sizeof(mp_dash_node_data)); } @@ -6987,7 +6982,7 @@ static void mp_adjust_bbox (MP mp, mp_edge_header_node h) static void mp_box_ends (MP mp, mp_knot p, mp_knot pp, mp_edge_header_node h) { if (mp_right_type(p) != mp_endpoint_knot) { - mp_fraction dx, dy; + mp_number dx, dy; mp_number d; mp_number z; mp_number xx, yy; @@ -7108,10 +7103,10 @@ void mp_set_bbox (MP mp, mp_edge_header_node h, int top_level) } break; } - while (mp_link(mp_bblast(h)) != NULL) { - mp_node p = mp_link(mp_bblast(h)); + while (mp_bblast(h)->link != NULL) { + mp_node p = mp_bblast(h)->link; mp_bblast(h) = p; - switch (mp_type(p)) { + switch (p->type) { case mp_stop_clip_node_type: if (top_level) { mp_confusion(mp, "clip"); @@ -7129,13 +7124,13 @@ void mp_set_bbox (MP mp, mp_edge_header_node h, int top_level) { int lev = 1; while (lev != 0) { - if (mp_link(p) == NULL) { + if (p->link == NULL) { mp_confusion(mp, "bounds"); } else { - p = mp_link(p); - if (mp_type(p) == mp_start_bounds_node_type) { + p = p->link; + if (p->type == mp_start_bounds_node_type) { ++lev; - } else if (mp_type(p) == mp_stop_bounds_node_type) { + } else if (p->type == mp_stop_bounds_node_type) { --lev; } } @@ -8015,7 +8010,7 @@ static mp_knot mp_make_envelope (MP mp, mp_knot c, mp_knot h, int linejoin, int mp_knot w, w0; int k, k0; mp_number qx, qy; - mp_fraction dxin, dyin, dxout, dyout; + mp_number dxin, dyin, dxout, dyout; int join_type = 0; mp_number tmp; mp_number max_ht; @@ -9074,7 +9069,7 @@ static void mp_new_indep (MP mp, mp_node p) if (mp->serial_no >= max_integer) { mp_fatal_error(mp, "Variable instance identifiers exhausted"); } - mp_type(p) = mp_independent_type; + p->type = mp_independent_type; mp->serial_no = mp->serial_no + 1; mp_set_indep_scale(p, 0); mp_set_indep_value(p, mp->serial_no); @@ -9098,7 +9093,7 @@ inline static void do_set_dep_value (MP mp, mp_value_node p, mp_number *q) static mp_value_node mp_get_dep_node (MP mp) { mp_value_node p = (mp_value_node) mp_new_value_node(mp); - mp_type(p) = mp_dep_node_type; + p->type = mp_dep_node_type; return p; } @@ -9136,7 +9131,7 @@ void mp_print_dependency (MP mp, mp_value_node p, int t) if (! number_equal(v, unity_t)) { print_number(v); } - if (mp_type(q) != mp_independent_type) { + if (q->type != mp_independent_type) { mp_confusion(mp, "dependency"); } else { mp_print_variable_name(mp, q); @@ -9145,14 +9140,14 @@ void mp_print_dependency (MP mp, mp_value_node p, int t) mp_print_str(mp, "*4"); number_add_scaled(v, -2); } - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; } } } static void mp_max_coef (MP mp, mp_number *x, mp_value_node p) { - mp_number(absv); + mp_number absv; new_number(absv); set_number_to_zero(*x); while (mp_get_dep_info(p) != NULL) { @@ -9160,7 +9155,7 @@ static void mp_max_coef (MP mp, mp_number *x, mp_value_node p) if (number_greater(absv, *x)) { number_clone(*x, absv); } - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; } free_number(absv); } @@ -9206,13 +9201,13 @@ static mp_value_node mp_p_plus_fq (MP mp, free_number(r1); mp_set_dep_value(p, v); s = p; - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; number_abs_clone(absv, v); if (number_less(absv, threshold)) { mp_free_dep_node(mp, s); } else { if (number_greaterequal(absv, coef_bound_k) && mp->watch_coefs) { - mp_type(qq) = independent_needing_fix; + qq->type = independent_needing_fix; mp->fix_needed = 1; } mp_set_link(r, s); @@ -9220,20 +9215,20 @@ static mp_value_node mp_p_plus_fq (MP mp, } free_number(absv); pp = mp_get_dep_info(p); - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; qq = mp_get_dep_info(q); } } else { if (pp == NULL) { set_number_to_negative_inf(v); - } else if (mp_type(pp) == mp_independent_type || (mp_type(pp) == independent_needing_fix && mp->fix_needed)) { + } else if (pp->type == mp_independent_type || (pp->type == independent_needing_fix && mp->fix_needed)) { set_number_from_scaled(v, mp_get_indep_value(pp)); } else { number_clone(v, mp_get_value_number(pp)); } if (qq == NULL) { set_number_to_negative_inf(vv); - } else if (mp_type(qq) == mp_independent_type || (mp_type(qq) == independent_needing_fix && mp->fix_needed)) { + } else if (qq->type == mp_independent_type || (qq->type == independent_needing_fix && mp->fix_needed)) { set_number_from_scaled(vv, mp_get_indep_value(qq)); } else { number_clone(vv, mp_get_value_number(qq)); @@ -9262,19 +9257,19 @@ static mp_value_node mp_p_plus_fq (MP mp, mp_set_dep_info(s, qq); mp_set_dep_value(s, v); if (number_greaterequal(absv, coef_bound_k) && mp->watch_coefs) { - mp_type(qq) = independent_needing_fix; + qq->type = independent_needing_fix; mp->fix_needed = 1; } mp_set_link(r, s); r = s; } - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; qq = mp_get_dep_info(q); free_number(absv); } else { mp_set_link(r, p); r = p; - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; pp = mp_get_dep_info(p); } } @@ -9304,7 +9299,7 @@ static mp_value_node mp_p_plus_fq (MP mp, free_number(half_threshold); free_number(v); free_number(vv); - return (mp_value_node) mp_link(mp->temp_head); + return (mp_value_node) mp->temp_head->link; } static mp_value_node mp_p_plus_q (MP mp, mp_value_node p, mp_value_node q, mp_variable_type t) @@ -9335,34 +9330,34 @@ static mp_value_node mp_p_plus_q (MP mp, mp_value_node p, mp_value_node q, mp_va set_number_from_addition(v, mp_get_dep_value(p), mp_get_dep_value(q)); mp_set_dep_value(p, v); s = p; - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; pp = mp_get_dep_info(p); number_abs_clone(test, v); if (number_less(test, threshold)) { mp_free_dep_node(mp, s); } else { if (number_greaterequal(test, coef_bound_k) && mp->watch_coefs) { - mp_type(qq) = independent_needing_fix; + qq->type = independent_needing_fix; mp->fix_needed = 1; } mp_set_link(r, s); r = s; } free_number(test); - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; qq = mp_get_dep_info(q); } } else { if (pp == NULL) { set_number_to_zero(v); - } else if (mp_type(pp) == mp_independent_type || (mp_type(pp) == independent_needing_fix && mp->fix_needed)) { + } else if (pp->type == mp_independent_type || (pp->type == independent_needing_fix && mp->fix_needed)) { set_number_from_scaled(v, mp_get_indep_value(pp)); } else { number_clone(v, mp_get_value_number(pp)); } if (qq == NULL) { set_number_to_zero(vv); - } else if (mp_type(qq) == mp_independent_type || (mp_type(qq) == independent_needing_fix && mp->fix_needed)) { + } else if (qq->type == mp_independent_type || (qq->type == independent_needing_fix && mp->fix_needed)) { set_number_from_scaled(vv, mp_get_indep_value(qq)); } else { number_clone(vv, mp_get_value_number(qq)); @@ -9371,14 +9366,14 @@ static mp_value_node mp_p_plus_q (MP mp, mp_value_node p, mp_value_node q, mp_va s = mp_get_dep_node(mp); mp_set_dep_info(s, qq); mp_set_dep_value(s, mp_get_dep_value(q)); - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; qq = mp_get_dep_info(q); mp_set_link(r, s); r = s; } else { mp_set_link(r, p); r = p; - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; pp = mp_get_dep_info(p); } } @@ -9395,7 +9390,7 @@ static mp_value_node mp_p_plus_q (MP mp, mp_value_node p, mp_value_node q, mp_va free_number(v); free_number(vv); free_number(threshold); - return (mp_value_node) mp_link(mp->temp_head); + return (mp_value_node) mp->temp_head->link; } static mp_value_node mp_p_times_v (MP mp, mp_value_node p, mp_number *v, int t0, int t1, int v_is_scaled) @@ -9422,18 +9417,18 @@ static mp_value_node mp_p_times_v (MP mp, mp_value_node p, mp_number *v, int t0, } number_abs_clone(test, w); if (number_lessequal(test, threshold)) { - s = (mp_value_node) mp_link(p); + s = (mp_value_node) p->link; mp_free_dep_node(mp, p); p = s; } else { if (number_greaterequal(test, coef_bound_k)) { mp->fix_needed = 1; - mp_type(mp_get_dep_info(p)) = independent_needing_fix; + mp_get_dep_info(p)->type = independent_needing_fix; } mp_set_link(r, p); r = p; mp_set_dep_value(p, w); - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; } free_number(test); } @@ -9451,7 +9446,7 @@ static mp_value_node mp_p_times_v (MP mp, mp_value_node p, mp_number *v, int t0, } free_number(w); free_number(threshold); - return (mp_value_node) mp_link(mp->temp_head); + return (mp_value_node) mp->temp_head->link; } mp_value_node mp_p_over_v (MP mp, mp_value_node p, mp_number *v_orig, int t0, int t1) @@ -9493,18 +9488,18 @@ mp_value_node mp_p_over_v (MP mp, mp_value_node p, mp_number *v_orig, int t0, in new_number(test); number_abs_clone(test, w); if (number_lessequal(test, threshold)) { - s = (mp_value_node) mp_link(p); + s = (mp_value_node) p->link; mp_free_dep_node(mp, p); p = s; } else { if (number_greaterequal(test, coef_bound_k)) { mp->fix_needed = 1; - mp_type(mp_get_dep_info(p)) = independent_needing_fix; + mp_get_dep_info(p)->type = independent_needing_fix; } mp_set_link(r, p); r = p; mp_set_dep_value(p, w); - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; } free_number(test); } @@ -9520,7 +9515,7 @@ mp_value_node mp_p_over_v (MP mp, mp_value_node p, mp_number *v_orig, int t0, in free_number(v); free_number(w); free_number(threshold); - return (mp_value_node) mp_link(mp->temp_head); + return (mp_value_node) mp->temp_head->link; } static mp_value_node mp_p_with_x_becoming_q (MP mp, mp_value_node p, mp_node x, mp_node q, int t) @@ -9530,7 +9525,7 @@ static mp_value_node mp_p_with_x_becoming_q (MP mp, mp_value_node p, mp_node x, int sx = mp_get_indep_value(x); while (mp_get_dep_info(s) != NULL && mp_get_indep_value(mp_get_dep_info(s)) > sx) { r = s; - s = (mp_value_node) mp_link(s); + s = (mp_value_node) s->link; } if (mp_get_dep_info(s) == NULL || mp_get_dep_info(s) != x) { return p; @@ -9538,10 +9533,10 @@ static mp_value_node mp_p_with_x_becoming_q (MP mp, mp_value_node p, mp_node x, mp_value_node ret; mp_number v1; mp_set_link(mp->temp_head, p); - mp_set_link(r, mp_link(s)); + mp_set_link(r, s->link); new_number_clone(v1, mp_get_dep_value(s)); mp_free_dep_node(mp, s); - ret = mp_p_plus_fq(mp, (mp_value_node) mp_link(mp->temp_head), &v1, (mp_value_node) q, t, mp_dependent_type); + ret = mp_p_plus_fq(mp, (mp_value_node) mp->temp_head->link, &v1, (mp_value_node) q, t, mp_dependent_type); free_number(v1); return ret; } @@ -9564,12 +9559,12 @@ static void mp_val_too_big (MP mp, mp_number *x) void mp_make_known (MP mp, mp_value_node p, mp_value_node q) { - mp_variable_type t = mp_type(p); + mp_variable_type t = p->type; mp_number absp; new_number(absp); - mp_set_prev_dep(mp_link(q), mp_get_prev_dep(p)); - mp_set_link(mp_get_prev_dep(p), mp_link(q)); - mp_type(p) = mp_known_type; + mp_set_prev_dep(q->link, mp_get_prev_dep(p)); + mp_set_link(mp_get_prev_dep(p), q->link); + p->type = mp_known_type; mp_set_value_number(p, mp_get_dep_value(q)); mp_free_dep_node(mp, q); number_abs_clone(absp, mp_get_value_number(p)); @@ -9594,7 +9589,7 @@ void mp_make_known (MP mp, mp_value_node p, mp_value_node q) static void mp_fix_dependencies (MP mp) { - mp_value_node r = (mp_value_node) mp_link(mp->dep_head); + mp_value_node r = (mp_value_node) mp->dep_head->link; mp_value_node s = NULL; while (r != mp->dep_head) { mp_value_node t = r; @@ -9604,40 +9599,40 @@ static void mp_fix_dependencies (MP mp) if (t == r) { q = (mp_value_node) mp_get_dep_list(t); } else { - q = (mp_value_node) mp_link(r); + q = (mp_value_node) r->link; } x = mp_get_dep_info(q); if (x == NULL) { break; - } else if (mp_type(x) <= independent_being_fixed) { - if (mp_type(x) < independent_being_fixed) { + } else if (x->type <= independent_being_fixed) { + if (x->type < independent_being_fixed) { mp_value_node p = mp_get_dep_node(mp); mp_set_link(p, s); s = p; mp_set_dep_info(s, x); - mp_type(x) = independent_being_fixed; + x->type = independent_being_fixed; } mp_set_dep_value(q, mp_get_dep_value(q)); number_divide_int(mp_get_dep_value(q), 4); if (number_zero(mp_get_dep_value(q))) { - mp_set_link(r, mp_link(q)); + mp_set_link(r, q->link); mp_free_dep_node(mp, q); q = r; } } r = q; } - r = (mp_value_node) mp_link(q); + r = (mp_value_node) q->link; if (q == (mp_value_node) mp_get_dep_list(t)) { mp_make_known(mp, t, q); } } while (s != NULL) { - mp_value_node p = (mp_value_node) mp_link(s); + mp_value_node p = (mp_value_node) s->link; mp_node x = mp_get_dep_info(s); mp_free_dep_node(mp, s); s = p; - mp_type(x) = mp_independent_type; + x->type = mp_independent_type; mp_set_indep_scale(x, mp_get_indep_scale(x) + 2); } mp->fix_needed = 0; @@ -9646,10 +9641,10 @@ static void mp_fix_dependencies (MP mp) static void mp_new_dep (MP mp, mp_node q, mp_variable_type newtype, mp_value_node p) { mp_node r; - mp_type(q) = newtype; + q->type = newtype; mp_set_dep_list(q, p); mp_set_prev_dep(q, (mp_node) mp->dep_head); - r = mp_link(mp->dep_head); + r = mp->dep_head->link; mp_set_link(mp->dep_final, r); mp_set_prev_dep(r, (mp_node) mp->dep_final); mp_set_link(mp->dep_head, q); @@ -9692,8 +9687,8 @@ static mp_value_node mp_copy_dep_list (MP mp, mp_value_node p) break; } else { mp_set_link(mp->dep_final, mp_get_dep_node(mp)); - mp->dep_final = (mp_value_node) mp_link(mp->dep_final); - p = (mp_value_node) mp_link(p); + mp->dep_final = (mp_value_node) mp->dep_final->link; + p = (mp_value_node) p->link; } } return q; @@ -9730,20 +9725,20 @@ static void mp_linear_eq (MP mp, mp_value_node p, int t) display_new_dependency(mp, p, (mp_node) x, n); } prev_r = (mp_value_node) mp->dep_head; - r = (mp_value_node) mp_link(mp->dep_head); + r = (mp_value_node) mp->dep_head->link; while (r != mp->dep_head) { mp_value_node s = (mp_value_node) mp_get_dep_list(r); - mp_value_node q = mp_p_with_x_becoming_q(mp, s, x, (mp_node) p, mp_type(r)); + mp_value_node q = mp_p_with_x_becoming_q(mp, s, x, (mp_node) p, r->type); if (mp_get_dep_info(q) == NULL) { mp_make_known(mp, r, q); } else { mp_set_dep_list(r, q); do { - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; } while (mp_get_dep_info(q) != NULL); prev_r = q; } - r = (mp_value_node) mp_link(prev_r); + r = (mp_value_node) prev_r->link; } if (n > 0) { p = divide_p_by_2_n(mp, p, n); @@ -9760,7 +9755,7 @@ static mp_value_node find_node_with_largest_coefficient (MP mp, mp_value_node p, mp_number vabs; mp_number rabs; mp_value_node q = p; - mp_value_node r = (mp_value_node) mp_link(p); + mp_value_node r = (mp_value_node) p->link; new_number(vabs); new_number(rabs); number_clone(*v, mp_get_dep_value(q)); @@ -9771,7 +9766,7 @@ static mp_value_node find_node_with_largest_coefficient (MP mp, mp_value_node p, q = r; number_clone(*v, mp_get_dep_value(r)); } - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; } free_number(vabs); free_number(rabs); @@ -9788,7 +9783,7 @@ static mp_value_node divide_p_by_minusv_removing_q (MP mp, mp_set_link(s, p); do { if (r == q) { - mp_set_link(s, mp_link(r)); + mp_set_link(s, r->link); mp_free_dep_node(mp, r); } else { mp_number w; @@ -9798,7 +9793,7 @@ static mp_value_node divide_p_by_minusv_removing_q (MP mp, make_fraction(w, mp_get_dep_value(r), *v); number_abs_clone(absw, w); if (number_lessequal(absw, half_fraction_threshold_k)) { - mp_set_link(s, mp_link(r)); + mp_set_link(s, r->link); mp_free_dep_node(mp, r); } else { number_negate(w); @@ -9808,7 +9803,7 @@ static mp_value_node divide_p_by_minusv_removing_q (MP mp, free_number(w); free_number(absw); } - r = (mp_value_node) mp_link(s); + r = (mp_value_node) s->link; } while (mp_get_dep_info(r) != NULL); if (t == mp_proto_dependent_type) { mp_number ret; @@ -9826,7 +9821,7 @@ static mp_value_node divide_p_by_minusv_removing_q (MP mp, free_number(ret); } *final_node = r; - return (mp_value_node) mp_link(mp->temp_head); + return (mp_value_node) mp->temp_head->link; } static void display_new_dependency (MP mp, mp_value_node p, mp_node x, int n) @@ -9867,15 +9862,15 @@ static mp_value_node divide_p_by_2_n (MP mp, mp_value_node p, int n) } number_abs_clone(absw, w); if (number_lessequal(absw, half_fraction_threshold_k) && (mp_get_dep_info(r) != NULL)) { - mp_set_link(s, mp_link(r)); + mp_set_link(s, r->link); mp_free_dep_node(mp, r); } else { mp_set_dep_value(r, w); s = r; } - r = (mp_value_node) mp_link(s); + r = (mp_value_node) s->link; } while (mp_get_dep_info(s) != NULL); - pp = (mp_value_node) mp_link(mp->temp_head); + pp = (mp_value_node) mp->temp_head->link; free_number(absw); free_number(w); } @@ -9887,7 +9882,7 @@ static void change_to_known (MP mp, mp_value_node p, mp_node x, mp_value_node fi (void) n; if (mp_get_dep_info(p) == NULL) { mp_number absx; - mp_type(x) = mp_known_type; + x->type = mp_known_type; mp_set_value_number(x, mp_get_dep_value(p)); new_number_abs(absx, mp_get_value_number(x)); if (number_greaterequal(absx, warning_limit_t)) { @@ -9912,8 +9907,8 @@ static void change_to_known (MP mp, mp_value_node p, mp_node x, mp_value_node fi static mp_node mp_new_ring_entry (MP mp, mp_node p) { mp_node q = mp_new_value_node(mp); - mp_name_type(q) = mp_capsule_operation; - mp_type(q) = mp_type(p); + q->name_type = mp_capsule_operation; + q->type = p->type; if (mp_get_value_node(p) == NULL) { mp_set_value_node(q, p); } else { @@ -9937,16 +9932,16 @@ void mp_ring_delete (MP mp, mp_node p) static void mp_nonlinear_eq (MP mp, mp_value v, mp_node p, int flush_p) { - mp_variable_type t = mp_type(p) - unknown_tag; + mp_variable_type t = p->type - unknown_tag; mp_node q = mp_get_value_node(p); if (flush_p) { - mp_type(p) = mp_vacuous_type; + p->type = mp_vacuous_type; } else { p = q; } do { mp_node r = mp_get_value_node(q); - mp_type(q) = t; + q->type = t; switch (t) { case mp_boolean_type: mp_set_value_number(q, v.data.n); @@ -10215,7 +10210,7 @@ static void mp_show_cmd_mod (MP mp, int c, int m) mp_print_cmd_mod(mp, mp_macro_def_command, c); mp_print_str(mp, "'d macro:"); mp_print_ln(mp); - mp_show_token_list(mp, mp_link(mp_link(cur_mod_node)),0); + mp_show_token_list(mp, cur_mod_node->link->link,0); break; default: mp_print_cmd_mod(mp, c, m); @@ -10302,7 +10297,7 @@ void mp_show_context (MP mp) mp_node pp = mp->param_stack[param_start]; mp_print_nl(mp, "<for("); if (pp != NULL) { - if (mp_link(pp) == MP_VOID) { + if (pp->link == MP_VOID) { mp_print_exp(mp, pp, 0); } else { mp_show_token_list(mp, pp, NULL); @@ -10332,12 +10327,12 @@ void mp_show_context (MP mp) mp_show_token_list(mp, mp->param_stack[param_start + 1], NULL); } else { mp_node qq = pp; - while (mp_link(qq) != NULL) { - qq = mp_link(qq); + while (qq->link != NULL) { + qq = qq->link; } - mp_link(qq) = mp->param_stack[param_start + 1]; + qq->link = mp->param_stack[param_start + 1]; mp_show_token_list(mp, pp, NULL); - mp_link(qq) = NULL; + qq->link = NULL; } } } @@ -10419,7 +10414,7 @@ static void mp_end_token_list (MP mp) --mp->param_ptr; p = mp->param_stack[mp->param_ptr]; if (p != NULL) { - if (mp_link(p) == MP_VOID) { + if (p->link == MP_VOID) { mp_recycle_value(mp, p); mp_free_value_node(mp, p); } else { @@ -10434,33 +10429,33 @@ static void mp_end_token_list (MP mp) static void mp_encapsulate (MP mp, mp_value_node p) { mp_node q = mp_new_value_node(mp); - mp_name_type(q) = mp_capsule_operation; + q->name_type = mp_capsule_operation; mp_new_dep(mp, q, mp->cur_exp.type, p); mp_set_cur_exp_node(mp, q); } static void mp_install (MP mp, mp_node r, mp_node q) { - if (mp_type(q) == mp_known_type) { - mp_type(r) = mp_known_type; + if (q->type == mp_known_type) { + r->type = mp_known_type; mp_set_value_number(r, mp_get_value_number(q)); - } else if (mp_type(q) == mp_independent_type) { + } else if (q->type == mp_independent_type) { mp_value_node p = mp_single_dependency(mp, q); if (p == mp->dep_final) { - mp_type(r) = mp_known_type; + r->type = mp_known_type; mp_set_value_number(r, zero_t); mp_free_dep_node(mp, p); } else { mp_new_dep(mp, r, mp_dependent_type, p); } } else { - mp_new_dep(mp, r, mp_type(q), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list((mp_value_node) q))); + mp_new_dep(mp, r, q->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list((mp_value_node) q))); } } static void mp_make_exp_copy (MP mp, mp_node p) { RESTART: - mp->cur_exp.type = mp_type(p); + mp->cur_exp.type = p->type; switch (mp->cur_exp.type) { case mp_vacuous_type: case mp_boolean_type: @@ -10500,7 +10495,7 @@ static void mp_make_exp_copy (MP mp, mp_node p) mp_node t; mp_value_node q; if (mp_get_value_node(p) == NULL) { - switch (mp_type(p)) { + switch (p->type) { case mp_pair_type: mp_init_pair_node(mp, p); break; @@ -10518,7 +10513,7 @@ static void mp_make_exp_copy (MP mp, mp_node p) } } t = mp_new_value_node(mp); - mp_name_type(t) = mp_capsule_operation; + t->name_type = mp_capsule_operation; q = (mp_value_node) mp_get_value_node(p); switch (mp->cur_exp.type) { case mp_pair_type: @@ -10594,25 +10589,25 @@ static mp_node mp_cur_tok (MP mp) number_clone(save_exp_num, cur_exp_value_number); mp_make_exp_copy(mp, cur_mod_node); p = mp_stash_cur_exp(mp); - mp_link(p) = NULL; + p->link = NULL; mp->cur_exp = save_exp; number_clone(mp->cur_exp.data.n, save_exp_num); free_number(save_exp_num); } else { p = mp_new_token_node(mp); - mp_name_type(p) = mp_token_operation; + p->name_type = mp_token_operation; if (cur_cmd == mp_numeric_command) { mp_set_value_number(p, cur_mod_number); - mp_type(p) = mp_known_type; + p->type = mp_known_type; } else { mp_set_value_str(p, cur_mod_str); - mp_type(p) = mp_string_type; + p->type = mp_string_type; } } } else { p = mp_new_symbolic_node(mp); mp_set_sym_sym(p, cur_sym); - mp_name_type(p) = cur_sym_mod; + p->name_type = cur_sym_mod; } return p; } @@ -10809,7 +10804,7 @@ void mp_runaway (MP mp) break; } mp_print_ln(mp); - mp_show_token_list(mp, mp_link(mp->hold_head), NULL); + mp_show_token_list(mp, mp->hold_head->link, NULL); } } @@ -10875,7 +10870,7 @@ void mp_get_next (MP mp) ); goto RESTART; } - mp_str_room(mp, (size_t) (loc - k)); + mp_str_room(mp, loc - k); do { mp_append_char(mp, mp->buffer[k]); ++k; @@ -10914,12 +10909,12 @@ void mp_get_next (MP mp) FOUND: set_cur_sym(mp_id_lookup(mp, (char *) (mp->buffer + k), (size_t) (loc - k), 1)); } else { - if (nloc != NULL && mp_type(nloc) == mp_symbol_node_type) { - int cur_sym_mod_ = mp_name_type(nloc); + if (nloc != NULL && nloc->type == mp_symbol_node_type) { + int cur_sym_mod_ = nloc->name_type; int cur_info = mp_get_sym_info(nloc); set_cur_sym(mp_get_sym_sym(nloc)); set_cur_sym_mod(cur_sym_mod_); - nloc = mp_link(nloc); + nloc = nloc->link; if (cur_sym_mod_ == mp_expr_operation) { set_cur_cmd(mp_capsule_command); set_cur_mod_node(mp->param_stack[param_start + cur_info]); @@ -10931,8 +10926,8 @@ void mp_get_next (MP mp) goto RESTART; } } else if (nloc != NULL) { - if (mp_name_type(nloc) == mp_token_operation) { - if (mp_type(nloc) == mp_known_type) { + if (nloc->name_type == mp_token_operation) { + if (nloc->type == mp_known_type) { set_cur_mod_number(mp_get_value_number(nloc)); set_cur_cmd(mp_numeric_command); } else { @@ -10944,7 +10939,7 @@ void mp_get_next (MP mp) set_cur_mod_node(nloc); set_cur_cmd(mp_capsule_command); } - nloc = mp_link(nloc); + nloc = nloc->link; return; } else { mp_end_token_list(mp); @@ -11153,7 +11148,7 @@ static mp_node mp_scan_toks (MP mp, mp_command_code terminator, mp_subst_list_it int cur_data_mod = 0; mp_node p = mp->hold_head; int balance = 1; - mp_link(mp->hold_head) = NULL; + mp->hold_head->link = NULL; while (1) { get_t_next(mp); cur_data = -1; @@ -11190,20 +11185,20 @@ static mp_node mp_scan_toks (MP mp, mp_command_code terminator, mp_subst_list_it if (cur_data != -1) { mp_node pp = mp_new_symbolic_node(mp); mp_set_sym_info(pp, cur_data); - mp_name_type(pp) = cur_data_mod; - mp_link(p) = pp; + pp->name_type = cur_data_mod; + p->link = pp; } else { - mp_link(p) = mp_cur_tok(mp); + p->link = mp_cur_tok(mp); } - p = mp_link(p); + p = p->link; } - mp_link(p) = tail_end; + p->link = tail_end; while (subst_list) { mp_subst_list_item *q = subst_list->link; mp_memory_free(subst_list); subst_list = q; } - return mp_link(mp->hold_head); + return mp->hold_head->link; } static void mp_get_symbol (MP mp) @@ -11280,10 +11275,10 @@ static void mp_make_op_def (MP mp, int code) q = mp_new_symbolic_node(mp); mp_set_ref_count(q, 0); r = mp_new_symbolic_node(mp); - mp_link(q) = r; + q->link = r; mp_set_sym_info(r, mp_general_macro); - mp_name_type(r) = mp_macro_operation; - mp_link(r) = mp_scan_toks(mp, mp_macro_def_command, qn, NULL, 0); + r->name_type = mp_macro_operation; + r->link = mp_scan_toks(mp, mp_macro_def_command, qn, NULL, 0); mp->scanner_status = mp_normal_state; set_eq_type(mp->warning_info, m); set_equiv_node(mp->warning_info, q); @@ -11301,7 +11296,7 @@ static void mp_scan_def (MP mp, int code) int sym_type; mp_sym l_delim, r_delim; int c = mp_general_macro; - mp_link(mp->hold_head) = NULL; + mp->hold_head->link = NULL; q = mp_new_symbolic_node(mp); mp_set_ref_count(q, 0); r = NULL; @@ -11315,7 +11310,7 @@ static void mp_scan_def (MP mp, int code) set_equiv_node(mp->warning_info, q); } else { p = mp_scan_declared_variable(mp); - mp_flush_variable(mp, equiv_node(mp_get_sym_sym(p)), mp_link(p), 1); + mp_flush_variable(mp, equiv_node(mp_get_sym_sym(p)), p->link, 1); mp->warning_info_node = mp_find_variable(mp, p); mp_flush_node_list(mp, p); if (mp->warning_info_node == NULL) { @@ -11333,7 +11328,7 @@ static void mp_scan_def (MP mp, int code) n = 3; get_t_next(mp); } - mp_type(mp->warning_info_node) = mp_unsuffixed_macro_type - 2 + n; + mp->warning_info_node->type = mp_unsuffixed_macro_type - 2 + n; mp_set_value_node(mp->warning_info_node, q); } k = n; @@ -11368,9 +11363,9 @@ static void mp_scan_def (MP mp, int code) sym_type = mp_expr_operation; OKAY: do { - mp_link(q) = mp_new_symbolic_node(mp); - q = mp_link(q); - mp_name_type(q) = sym_type; + q->link = mp_new_symbolic_node(mp); + q = q->link; + q->name_type = sym_type; mp_set_sym_info(q, k); mp_get_symbol(mp); rp = mp_memory_allocate(sizeof(mp_subst_list_item)); @@ -11438,17 +11433,17 @@ static void mp_scan_def (MP mp, int code) mp_check_equals(mp); p = mp_new_symbolic_node(mp); mp_set_sym_info(p, c); - mp_name_type(p) = mp_macro_operation; - mp_link(q) = p; + p->name_type = mp_macro_operation; + q->link = p; if (code == mp_def_code) { - mp_link(p) = mp_scan_toks(mp, mp_macro_def_command, r, NULL, (int) n); + p->link = mp_scan_toks(mp, mp_macro_def_command, r, NULL, (int) n); } else { mp_node qq = mp_new_symbolic_node(mp); mp_set_sym_sym(qq, mp->bg_loc); - mp_link(p) = qq; + p->link = qq; p = mp_new_symbolic_node(mp); mp_set_sym_sym(p, mp->eg_loc); - mp_link(qq) = mp_scan_toks(mp, mp_macro_def_command, r, p, (int) n); + qq->link = mp_scan_toks(mp, mp_macro_def_command, r, p, (int) n); } if (mp->warning_info_node == mp->bad_vardef) { mp_flush_token_list(mp, mp_get_value_node(mp->bad_vardef)); @@ -11797,16 +11792,16 @@ static void mp_macro_call (MP mp, mp_node def_ref, mp_node arg_list, mp_sym macr mp_node tail = 0; mp_sym l_delim = NULL; mp_sym r_delim = NULL; - mp_node r = mp_link(def_ref); + mp_node r = def_ref->link; mp_add_mac_ref(def_ref); if (arg_list == NULL) { n = 0; } else { n = 1; tail = arg_list; - while (mp_link(tail) != NULL) { + while (tail->link != NULL) { ++n; - tail = mp_link(tail); + tail = tail->link; } } if (number_positive(internal_value(mp_tracing_macros_internal))) { @@ -11824,13 +11819,13 @@ static void mp_macro_call (MP mp, mp_node def_ref, mp_node arg_list, mp_sym macr mp_node q = (mp_node) mp_get_sym_sym(p); mp_print_arg(mp, q, n, 0, 0); ++n; - p = mp_link(p); + p = p->link; } while (p != NULL); } mp_end_diagnostic(mp, 0); } set_cur_cmd(mp_comma_command + 1); - while (mp_name_type(r) == mp_expr_operation || mp_name_type(r) == mp_suffix_operation || mp_name_type(r) == mp_text_operation) { + while (r->name_type == mp_expr_operation || r->name_type == mp_suffix_operation || r->name_type == mp_text_operation) { if (cur_cmd != mp_comma_command) { mp_get_x_next(mp); if (cur_cmd != mp_left_delimiter_command) { @@ -11843,7 +11838,7 @@ static void mp_macro_call (MP mp, mp_node def_ref, mp_node arg_list, mp_sym macr mp->selector = selector; mp_snprintf(msg, 256, "Missing argument to %s", mp_str(mp, sname)); delete_str_ref(sname); - if (mp_name_type(r) == mp_suffix_operation || mp_name_type(r) == mp_text_operation) { + if (r->name_type == mp_suffix_operation || r->name_type == mp_text_operation) { mp_set_cur_exp_value_number(mp, &zero_t); mp->cur_exp.type = mp_token_list_type; } else { @@ -11862,18 +11857,18 @@ static void mp_macro_call (MP mp, mp_node def_ref, mp_node arg_list, mp_sym macr l_delim = cur_sym; r_delim = equiv_sym(cur_sym); } - if (mp_name_type(r) == mp_text_operation) { + if (r->name_type == mp_text_operation) { mp_scan_text_arg(mp, l_delim, r_delim); } else { mp_get_x_next(mp); - if (mp_name_type(r) == mp_suffix_operation) { + if (r->name_type == mp_suffix_operation) { mp_scan_suffix(mp); } else { mp_scan_expression(mp); } } if ((cur_cmd != mp_comma_command) && ((cur_cmd != mp_right_delimiter_command) || (equiv_sym(cur_sym) != l_delim))) { - switch (mp_name_type(mp_link(r))) { + switch (r->link->name_type) { case mp_expr_operation: case mp_suffix_operation: case mp_text_operation: @@ -11906,19 +11901,19 @@ static void mp_macro_call (MP mp, mp_node def_ref, mp_node arg_list, mp_sym macr } if (number_positive(internal_value(mp_tracing_macros_internal))) { mp_begin_diagnostic(mp); - mp_print_arg(mp, (mp_node) mp_get_sym_sym(p), n, mp_get_sym_info(r), mp_name_type(r)); + mp_print_arg(mp, (mp_node) mp_get_sym_sym(p), n, mp_get_sym_info(r), r->name_type); mp_end_diagnostic(mp, 0); } if (arg_list == NULL) { arg_list = p; } else { - mp_link(tail) = p; + tail->link = p; } tail = p; ++n; } - r = mp_link(r); + r = r->link; } if (cur_cmd == mp_comma_command) { char msg[256]; @@ -11975,7 +11970,7 @@ static void mp_macro_call (MP mp, mp_node def_ref, mp_node arg_list, mp_sym macr if (arg_list == NULL) { arg_list = p; } else { - mp_link(tail) = p; + tail->link = p; } tail = p; ++n; @@ -12029,20 +12024,20 @@ static void mp_macro_call (MP mp, mp_node def_ref, mp_node arg_list, mp_sym macr } if (number_positive(internal_value(mp_tracing_macros_internal))) { mp_begin_diagnostic(mp); - mp_print_arg(mp, (mp_node) mp_get_sym_sym(p), n, mp_get_sym_info(r), mp_name_type(r)); + mp_print_arg(mp, (mp_node) mp_get_sym_sym(p), n, mp_get_sym_info(r), r->name_type); mp_end_diagnostic(mp, 0); } if (arg_list == NULL) { arg_list = p; } else { - mp_link(tail) = p; + tail->link = p; } tail = p; ++n; } } - r = mp_link(r); + r = r->link; while (token_state && (nloc == NULL)) { mp_end_token_list(mp); @@ -12059,7 +12054,7 @@ static void mp_macro_call (MP mp, mp_node def_ref, mp_node arg_list, mp_sym macr do { mp->param_stack[mp->param_ptr] = (mp_node) mp_get_sym_sym(p); ++mp->param_ptr; - p = mp_link(p); + p = p->link; } while (p != NULL); mp_flush_node_list(mp, arg_list); } @@ -12073,21 +12068,21 @@ static void mp_print_macro_name (MP mp, mp_node a, mp_sym n) mp_node p = (mp_node) mp_get_sym_sym(a); if (p) { mp_node q = p; - while (mp_link(q) != NULL) { - q = mp_link(q); + while (q->link != NULL) { + q = q->link; } - mp_link(q) = (mp_node) mp_get_sym_sym(mp_link(a)); + q->link = (mp_node) mp_get_sym_sym(a->link); mp_show_token_list(mp, p, NULL); - mp_link(q) = NULL; + q->link = NULL; } else { - mp_print_mp_str(mp,text(mp_get_sym_sym((mp_node) mp_get_sym_sym(mp_link(a))))); + mp_print_mp_str(mp,text(mp_get_sym_sym((mp_node) mp_get_sym_sym(a->link)))); } } } static void mp_print_arg (MP mp, mp_node q, int n, int b, int bb) { - if (q && mp_link(q) == MP_VOID) { + if (q && q->link == MP_VOID) { mp_print_nl(mp, "(EXPR"); } else if ((bb < mp_text_operation) && (b != mp_text_macro)) { mp_print_nl(mp, "(SUFFIX"); @@ -12096,7 +12091,7 @@ static void mp_print_arg (MP mp, mp_node q, int n, int b, int bb) } mp_print_int(mp, n); mp_print_str(mp, ")<-"); - if (q && mp_link(q) == MP_VOID) { + if (q && q->link == MP_VOID) { mp_print_exp(mp, q, 1); } else { mp_show_token_list(mp, q, NULL); @@ -12109,7 +12104,7 @@ void mp_scan_text_arg (MP mp, mp_sym l_delim, mp_sym r_delim) mp->warning_info = l_delim; mp->scanner_status = mp_absorbing_state; mp_node p = mp->hold_head; - mp_link(mp->hold_head) = NULL; + mp->hold_head->link = NULL; while (1) { get_t_next(mp); if (l_delim == NULL) { @@ -12136,10 +12131,10 @@ void mp_scan_text_arg (MP mp, mp_sym l_delim, mp_sym r_delim) } } } - mp_link(p) = mp_cur_tok(mp); - p = mp_link(p); + p->link = mp_cur_tok(mp); + p = p->link; } - mp_set_cur_exp_node(mp, mp_link(mp->hold_head)); + mp_set_cur_exp_node(mp, mp->hold_head->link); mp->cur_exp.type = mp_token_list_type; mp->scanner_status = mp_normal_state; } @@ -12156,7 +12151,7 @@ static void mp_stack_argument (MP mp, mp_node p) static mp_node mp_get_if_node (MP mp) { mp_if_node p = (mp_if_node) mp_allocate_node(mp, sizeof(mp_if_node_data)); - mp_type(p) = mp_if_node_type; + p->type = mp_if_node_type; return (mp_node) p; } @@ -12187,9 +12182,9 @@ void mp_pass_text (MP mp) static void mp_push_condition_stack (MP mp) { mp_node p = mp_get_if_node(mp); - mp_link(p) = mp->cond_ptr; - mp_type(p) = (int) mp->if_limit; - mp_name_type(p) = mp->cur_if; + p->link = mp->cond_ptr; + p->type = (int) mp->if_limit; + p->name_type = mp->cur_if; mp_if_line_field(p) = mp->if_line; mp->cond_ptr = p; mp->if_limit = mp_if_code; @@ -12201,9 +12196,9 @@ static void mp_pop_condition_stack (MP mp) { mp_node p = mp->cond_ptr; mp->if_line = mp_if_line_field(p); - mp->cur_if = mp_name_type(p); - mp->if_limit = mp_type(p); - mp->cond_ptr = mp_link(p); + mp->cur_if = p->name_type; + mp->if_limit = p->type; + mp->cond_ptr = p->link; mp_free_node(mp, p, sizeof(mp_if_node_data)); } @@ -12217,11 +12212,11 @@ static void mp_change_if_limit (MP mp, int l, mp_node p) if (q == NULL) { mp_confusion(mp, "if"); return; - } else if (mp_link(q) == p) { - mp_type(q) = l; + } else if (q->link == p) { + q->type = l; return; } else { - q = mp_link(q); + q = q->link; } } } @@ -12386,9 +12381,9 @@ void mp_begin_iteration (MP mp) } s->type = mp->cur_exp.data.node; mp->cur_exp.type = mp_vacuous_type; - q = mp_link(mp_edge_list(mp->cur_exp.data.node)); + q = mp_edge_list(mp->cur_exp.data.node)->link; if (q != NULL && mp_is_start_or_stop (q) && mp_skip_1component(mp, q) == NULL) { - q = mp_link(q); + q = q->link; } s->list = q; } @@ -12447,13 +12442,13 @@ void mp_begin_iteration (MP mp) } mp_set_cur_exp_node(mp, mp_stash_cur_exp(mp)); } - mp_link(q) = mp_new_symbolic_node(mp); - q = mp_link(q); + q->link = mp_new_symbolic_node(mp); + q = q->link; mp_set_sym_sym(q, mp->cur_exp.data.node); if (m == mp_start_for_code) { - mp_name_type(q) = mp_expr_operation; + q->name_type = mp_expr_operation; } else if (m == mp_start_forsuffixes_code) { - mp_name_type(q) = mp_suffix_operation; + q->name_type = mp_suffix_operation; } mp->cur_exp.type = mp_vacuous_type; CONTINUE: @@ -12520,7 +12515,7 @@ void mp_resume_iteration (MP mp) p = mp->loop_ptr->list; if (p != NULL && p == mp->loop_ptr->list_start) { q = p; - p = mp_link(p); + p = p->link; mp_free_symbolic_node(mp, q); mp->loop_ptr->list = p; } @@ -12528,7 +12523,7 @@ void mp_resume_iteration (MP mp) mp_stop_iteration(mp); return; } - mp->loop_ptr->list = mp_link(p); + mp->loop_ptr->list = p->link; q = (mp_node) mp_get_sym_sym(p); if (q) { number_clone(mp->loop_ptr->old_value, q->data.n); @@ -12542,7 +12537,7 @@ void mp_resume_iteration (MP mp) if (q == NULL) { goto NOT_FOUND; } else if (! mp_is_start_or_stop(q)) { - q = mp_link(q); + q = q->link; } else if (! mp_is_stop(q)) { q = mp_skip_1component(mp, q); } else { @@ -12559,7 +12554,7 @@ void mp_resume_iteration (MP mp) if (number_greater(internal_value(mp_tracing_commands_internal), unity_t)) { mp_begin_diagnostic(mp); mp_print_nl(mp, "{loop value="); - if ((q != NULL) && (mp_link(q) == MP_VOID)) { + if ((q != NULL) && (q->link == MP_VOID)) { mp_print_exp(mp, q, 1); } else { mp_show_token_list(mp, q, NULL); @@ -12585,7 +12580,7 @@ void mp_stop_iteration (MP mp) while (q != NULL) { p = (mp_node) mp_get_sym_sym(q); if (p != NULL) { - if (mp_link(p) == MP_VOID) { + if (p->link == MP_VOID) { mp_recycle_value(mp, p); mp_free_value_node(mp, p); } else { @@ -12593,7 +12588,7 @@ void mp_stop_iteration (MP mp) } } p = q; - q = mp_link(q); + q = q->link; mp_free_symbolic_node(mp, p); } } else if (p > MP_PROGRESSION_FLAG) { @@ -12857,8 +12852,8 @@ static mp_node mp_stash_cur_exp (MP mp) break; default: p = mp_new_value_node(mp); - mp_name_type(p) = mp_capsule_operation; - mp_type(p) = mp->cur_exp.type; + p->name_type = mp_capsule_operation; + p->type = mp->cur_exp.type; mp_set_value_number(p, cur_exp_value_number); if (cur_exp_str) { mp_set_value_str(p, cur_exp_str); @@ -12870,13 +12865,13 @@ static mp_node mp_stash_cur_exp (MP mp) break; } mp->cur_exp.type = mp_vacuous_type; - mp_link(p) = MP_VOID; + p->link = MP_VOID; return p; } void mp_unstash_cur_exp (MP mp, mp_node p) { - mp->cur_exp.type = mp_type(p); + mp->cur_exp.type = p->type; switch (mp->cur_exp.type) { case mp_unknown_boolean_type: case mp_unknown_string_type: @@ -12943,7 +12938,7 @@ void mp_print_exp (MP mp, mp_node p, int verbosity) p = mp_stash_cur_exp(mp); restore_cur_exp = 1; } - t = mp_type(p); + t = p->type; if (t < mp_dependent_type) { if (t != mp_vacuous_type && t != mp_known_type && mp_get_value_node(p) != NULL) { v = mp_get_value_node(p); @@ -12972,7 +12967,7 @@ void mp_print_exp (MP mp, mp_node p, int verbosity) mp_print_type(mp, t); if (v != NULL) { mp_print_chr(mp, ' '); - while ((mp_name_type(v) == mp_capsule_operation) && (v != p)) { + while ((v->name_type == mp_capsule_operation) && (v != p)) { v = mp_get_value_node(v); } mp_print_variable_name(mp, v); @@ -13097,7 +13092,7 @@ void mp_print_exp (MP mp, mp_node p, int verbosity) void mp_print_big_node (MP mp, mp_node v, int verbosity) { - switch (mp_type(v)) { + switch (v->type) { case mp_known_type: print_number(mp_get_value_number(v)); break; @@ -13105,14 +13100,14 @@ void mp_print_big_node (MP mp, mp_node v, int verbosity) mp_print_variable_name(mp, v); break; default: - mp_print_dp(mp, mp_type(v), (mp_value_node) mp_get_dep_list((mp_value_node) v), verbosity); + mp_print_dp(mp, v->type, (mp_value_node) mp_get_dep_list((mp_value_node) v), verbosity); break; } } static void mp_print_dp (MP mp, int t, mp_value_node p, int verbosity) { - mp_value_node q = (mp_value_node) mp_link(p); + mp_value_node q = (mp_value_node) p->link; if ((mp_get_dep_info(q) == NULL) || (verbosity > 0)) { mp_print_dependency(mp, p, t); } else { @@ -13172,7 +13167,7 @@ void mp_flush_cur_exp (MP mp, mp_value v) static void mp_recycle_value (MP mp, mp_node p) { if (p != NULL && p != MP_VOID) { - mp_variable_type t = mp_type(p); + mp_variable_type t = p->type; switch (t) { case mp_vacuous_type: case mp_boolean_type: @@ -13253,10 +13248,10 @@ static void mp_recycle_value (MP mp, mp_node p) { mp_value_node qq = (mp_value_node) mp_get_dep_list((mp_value_node) p); while (mp_get_dep_info(qq) != NULL) { - qq = (mp_value_node) mp_link(qq); + qq = (mp_value_node) qq->link; } - mp_set_link(mp_get_prev_dep((mp_value_node) p), mp_link(qq)); - mp_set_prev_dep(mp_link(qq), mp_get_prev_dep((mp_value_node) p)); + mp_set_link(mp_get_prev_dep((mp_value_node) p), qq->link); + mp_set_prev_dep(qq->link, mp_get_prev_dep((mp_value_node) p)); mp_set_link(qq, NULL); mp_flush_node_list(mp, (mp_node) mp_get_dep_list((mp_value_node) p)); } @@ -13275,7 +13270,7 @@ static void mp_recycle_value (MP mp, mp_node p) default: break; } - mp_type(p) = mp_undefined_type; + p->type = mp_undefined_type; } } @@ -13285,7 +13280,7 @@ static void mp_recycle_independent_value (MP mp, mp_node p) mp_node pp; mp_number v ; mp_number test; - mp_variable_type t = mp_type(p); + mp_variable_type t = p->type; new_number(test); new_number(v); if (t < mp_dependent_type) { @@ -13295,22 +13290,22 @@ static void mp_recycle_independent_value (MP mp, mp_node p) set_number_to_zero(mp->max_c[mp_proto_dependent_type]); mp->max_link[mp_dependent_type] = NULL; mp->max_link[mp_proto_dependent_type] = NULL; - q = (mp_value_node) mp_link(mp->dep_head); + q = (mp_value_node) mp->dep_head->link; while (q != mp->dep_head) { s = (mp_value_node) mp->temp_head; mp_set_link(s, mp_get_dep_list(q)); while (1) { - r = (mp_value_node) mp_link(s); + r = (mp_value_node) s->link; if (mp_get_dep_info(r) == NULL) { break; } else if (mp_get_dep_info(r) != p) { s = r; } else { - t = mp_type(q); - if (mp_link(s) == mp_get_dep_list(q)) { - mp_set_dep_list(q, mp_link(r)); + t = q->type; + if (s->link == mp_get_dep_list(q)) { + mp_set_dep_list(q, r->link); } - mp_set_link(s, mp_link(r)); + mp_set_link(s, r->link); mp_set_dep_info(r, (mp_node) q); number_abs_clone(test, mp_get_dep_value(r)); if (number_greater(test, mp->max_c[t])) { @@ -13326,7 +13321,7 @@ static void mp_recycle_independent_value (MP mp, mp_node p) } } } - q = (mp_value_node) mp_link(r); + q = (mp_value_node) r->link; } if (number_positive(mp->max_c[mp_dependent_type]) || number_positive(mp->max_c[mp_proto_dependent_type])) { mp_number test, ret; @@ -13350,9 +13345,9 @@ static void mp_recycle_independent_value (MP mp, mp_node p) r = (mp_value_node) mp_get_dep_list((mp_value_node) pp); mp_set_link(s, r); while (mp_get_dep_info(r) != NULL) { - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; } - q = (mp_value_node) mp_link(r); + q = (mp_value_node) r->link; mp_set_link(r, NULL); mp_set_prev_dep(q, mp_get_prev_dep((mp_value_node) pp)); mp_set_link(mp_get_prev_dep((mp_value_node) pp), (mp_node) q); @@ -13383,7 +13378,7 @@ static void mp_recycle_independent_value (MP mp, mp_node p) mp_make_known(mp, q, mp->dep_final); } q = r; - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; mp_free_dep_node(mp, q); } } @@ -13397,7 +13392,7 @@ static void mp_recycle_independent_value (MP mp, mp_node p) mp->cur_exp.type = mp_proto_dependent_type; } mp_set_dep_list(q, mp_p_over_v(mp, (mp_value_node) mp_get_dep_list(q), &unity_t, mp_dependent_type, mp_proto_dependent_type)); - mp_type(q) = mp_proto_dependent_type; + q->type = mp_proto_dependent_type; fraction_to_round_scaled(mp_get_dep_value(r)); } number_negated_clone(test, v); @@ -13407,7 +13402,7 @@ static void mp_recycle_independent_value (MP mp, mp_node p) mp_make_known(mp, q, mp->dep_final); } q = r; - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; mp_free_dep_node(mp, q); } } @@ -13484,13 +13479,13 @@ static void mp_bad_exp (MP mp, const char *s) static void mp_stash_in (MP mp, mp_node p) { - mp_type(p) = mp->cur_exp.type; + p->type = mp->cur_exp.type; if (mp->cur_exp.type == mp_known_type) { mp_set_value_number(p, cur_exp_value_number); } else if (mp->cur_exp.type == mp_independent_type) { mp_value_node q = mp_single_dependency(mp, cur_exp_node); if (q == mp->dep_final) { - mp_type(p) = mp_known_type; + p->type = mp_known_type; mp_set_value_number(p, zero_t); mp_free_dep_node(mp, q); } else { @@ -13510,7 +13505,7 @@ static void mp_stash_in (MP mp, mp_node p) static void mp_back_expr (MP mp) { mp_node p = mp_stash_cur_exp(mp); - mp_link(p) = NULL; + p->link = NULL; mp_begin_token_list(mp, p, mp_backed_up_text); } @@ -13548,7 +13543,7 @@ static void mp_binary_mac (MP mp, mp_node p, mp_node c, mp_sym n) { mp_node q = mp_new_symbolic_node(mp); mp_node r = mp_new_symbolic_node(mp); - mp_link(q) = r; + q->link = r; mp_set_sym_sym(q, p); mp_set_sym_sym(r, mp_stash_cur_exp(mp)); mp_macro_call(mp, c, q, n); @@ -13588,7 +13583,7 @@ void mp_known_pair (MP mp) set_number_to_zero(mp->cur_y); } else { mp_node p = mp_get_value_node(cur_exp_node); - if (mp_type(mp_x_part(p)) == mp_known_type) { + if (mp_x_part(p)->type == mp_known_type) { number_clone(mp->cur_x, mp_get_value_number(mp_x_part(p))); } else { mp_disp_err(mp, mp_x_part(p)); @@ -13602,7 +13597,7 @@ void mp_known_pair (MP mp) mp_recycle_value(mp, mp_x_part(p)); set_number_to_zero(mp->cur_x); } - if (mp_type(mp_y_part(p)) == mp_known_type) { + if (mp_y_part(p)->type == mp_known_type) { number_clone(mp->cur_y, mp_get_value_number(mp_y_part(p))); } else { mp_disp_err(mp, mp_y_part(p)); @@ -13826,16 +13821,16 @@ static void mp_do_nullary (MP mp, int c) static int mp_pict_color_type (MP mp, int c) { return ( - (mp_link(mp_edge_list(cur_exp_node)) != NULL) + (mp_edge_list(cur_exp_node)->link != NULL) && ( - (! mp_has_color(mp_link(mp_edge_list(cur_exp_node)))) + (! mp_has_color(mp_edge_list(cur_exp_node)->link)) || (( - (mp_color_model(mp_link(mp_edge_list(cur_exp_node))) == c) + (mp_color_model(mp_edge_list(cur_exp_node)->link) == c) || ( - (mp_color_model(mp_link(mp_edge_list(cur_exp_node))) == mp_uninitialized_model) + (mp_color_model(mp_edge_list(cur_exp_node)->link) == mp_uninitialized_model) && (number_to_scaled(internal_value(mp_default_color_model_internal))/number_to_scaled(unity_t)) == c ) @@ -13881,7 +13876,7 @@ static int mp_nice_pair (MP mp, mp_node p, int t) (void) mp; if (t == mp_pair_type) { p = mp_get_value_node(p); - if (mp_type(mp_x_part(p)) == mp_known_type && mp_type(mp_y_part(p)) == mp_known_type) + if (mp_x_part(p)->type == mp_known_type && mp_y_part(p)->type == mp_known_type) return 1; } return 0; @@ -13893,23 +13888,25 @@ static int mp_nice_color_or_pair (MP mp, mp_node p, int t) switch (t) { case mp_pair_type: q = mp_get_value_node(p); - if (mp_type(mp_x_part(q)) == mp_known_type - && mp_type(mp_y_part(q)) == mp_known_type) + if (mp_x_part(q)->type == mp_known_type + && mp_y_part(q)->type == mp_known_type) { return 1; - break; + } else { + break; + } case mp_color_type: q = mp_get_value_node(p); - if (mp_type(mp_red_part (q)) == mp_known_type - && mp_type(mp_green_part(q)) == mp_known_type - && mp_type(mp_blue_part (q)) == mp_known_type) + if (mp_red_part (q)->type == mp_known_type + && mp_green_part(q)->type == mp_known_type + && mp_blue_part (q)->type == mp_known_type) return 1; break; case mp_cmykcolor_type: q = mp_get_value_node(p); - if (mp_type(mp_cyan_part (q)) == mp_known_type - && mp_type(mp_magenta_part(q)) == mp_known_type - && mp_type(mp_yellow_part (q)) == mp_known_type - && mp_type(mp_black_part (q)) == mp_known_type) + if (mp_cyan_part (q)->type == mp_known_type + && mp_magenta_part(q)->type == mp_known_type + && mp_yellow_part (q)->type == mp_known_type + && mp_black_part (q)->type == mp_known_type) return 1; break; } @@ -13963,12 +13960,12 @@ static void mp_negate_dep_list (MP mp, mp_value_node p) number_negate(mp_get_dep_value(p)); if (mp_get_dep_info(p) == NULL) return; - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; } } static void mp_negate_value(MP mp, mp_node r) { - if (mp_type(r) == mp_known_type) { + if (r->type == mp_known_type) { mp_set_value_number(r, mp_get_value_number(r)); number_negate(mp_get_value_number(r)); } else { @@ -14036,8 +14033,8 @@ static void mp_take_part (MP mp, int c) { mp_node p = mp_get_value_node(cur_exp_node); mp_set_value_node(mp->temp_val, p); - mp_type(mp->temp_val) = mp->cur_exp.type; - mp_link(p) = mp->temp_val; + mp->temp_val->type = mp->cur_exp.type; + p->link= mp->temp_val; mp_free_value_node(mp, cur_exp_node); switch (c) { case mp_x_part_operation: @@ -14099,7 +14096,7 @@ static void mp_take_pict_part (MP mp, int c) mp_value new_expr; memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); - p = mp_link(mp_edge_list(cur_exp_node)); + p = mp_edge_list(cur_exp_node)->link; if (p != NULL) { switch (c) { case mp_x_part_operation: @@ -14212,7 +14209,7 @@ static void mp_take_pict_part (MP mp, int c) mp_confusion(mp, "picture"); } else { new_expr.data.node = NULL; - switch (mp_type(p)) { + switch (p->type) { case mp_fill_node_type: case mp_stroked_node_type: new_expr.data.p = mp_copy_path(mp, mp_path_ptr((mp_shape_node) p)); @@ -14233,7 +14230,7 @@ static void mp_take_pict_part (MP mp, int c) if (! mp_has_pen(p)) { goto NOT_FOUND; } else { - switch (mp_type(p)) { + switch (p->type) { case mp_fill_node_type: case mp_stroked_node_type: if (mp_pen_ptr((mp_shape_node) p) == NULL) { @@ -14250,7 +14247,7 @@ static void mp_take_pict_part (MP mp, int c) } break; case mp_dash_part_operation: - if (mp_type(p) != mp_stroked_node_type) { + if (p->type != mp_stroked_node_type) { goto NOT_FOUND; } else if (mp_dash_ptr(p) == NULL) { goto NOT_FOUND; @@ -14330,15 +14327,15 @@ static void mp_path_length (MP mp, mp_number *n) } static void mp_picture_length (MP mp, mp_number *n) { - mp_node p = mp_link(mp_edge_list(cur_exp_node)); + mp_node p = mp_edge_list(cur_exp_node)->link; int l = 0; if (p != NULL) { if (mp_is_start_or_stop(p) && mp_skip_1component(mp, p) == NULL) { - p = mp_link(p); + p = p->link; } while (p != NULL) { if (! mp_is_start_or_stop(p)) { - p = mp_link(p); + p = p->link; } else if (! mp_is_stop(p)) { p = mp_skip_1component(mp, p); } else { @@ -14364,13 +14361,13 @@ static void mp_bezier_slope (MP mp, static void mp_turn_cycles (MP mp, mp_number *turns, mp_knot c) { int selector; - mp_angle res, ang; + mp_number res, ang; mp_knot p; mp_number xp, yp; mp_number x, y; mp_number arg1, arg2; - mp_angle in_angle, out_angle; - mp_angle seven_twenty_deg_t; + mp_number in_angle, out_angle; + mp_number seven_twenty_deg_t; set_number_to_zero(*turns); new_number(arg1); new_number(arg2); @@ -14492,12 +14489,12 @@ static int mp_test_known (MP mp, int c) case mp_transform_type: { mp_node p = mp_get_value_node(cur_exp_node); - if ( (mp_type(mp_tx_part(p)) == mp_known_type) && - (mp_type(mp_ty_part(p)) == mp_known_type) && - (mp_type(mp_xx_part(p)) == mp_known_type) && - (mp_type(mp_xy_part(p)) == mp_known_type) && - (mp_type(mp_yx_part(p)) == mp_known_type) && - (mp_type(mp_yy_part(p)) == mp_known_type) ) { + if ( (mp_tx_part(p)->type == mp_known_type) && + (mp_ty_part(p)->type == mp_known_type) && + (mp_xx_part(p)->type == mp_known_type) && + (mp_xy_part(p)->type== mp_known_type) && + (mp_yx_part(p)->type == mp_known_type) && + (mp_yy_part(p)->type == mp_known_type) ) { b = mp_true_operation; } } @@ -14505,9 +14502,9 @@ static int mp_test_known (MP mp, int c) case mp_color_type: { mp_node p = mp_get_value_node(cur_exp_node); - if ( (mp_type(mp_red_part(p)) == mp_known_type) && - (mp_type(mp_green_part(p)) == mp_known_type) && - (mp_type(mp_blue_part(p)) == mp_known_type) ) { + if ( (mp_red_part (p)->type == mp_known_type) && + (mp_green_part(p)->type == mp_known_type) && + (mp_blue_part (p)->type == mp_known_type) ) { b = mp_true_operation; } } @@ -14515,10 +14512,10 @@ static int mp_test_known (MP mp, int c) case mp_cmykcolor_type: { mp_node p = mp_get_value_node(cur_exp_node); - if ( (mp_type(mp_cyan_part(p)) == mp_known_type) && - (mp_type(mp_magenta_part(p)) == mp_known_type) && - (mp_type(mp_yellow_part(p)) == mp_known_type) && - (mp_type(mp_black_part(p)) == mp_known_type) ) { + if ( (mp_cyan_part (p)->type == mp_known_type) && + (mp_magenta_part(p)->type == mp_known_type) && + (mp_yellow_part (p)->type == mp_known_type) && + (mp_black_part (p)->type == mp_known_type) ) { b = mp_true_operation; } } @@ -14526,8 +14523,8 @@ static int mp_test_known (MP mp, int c) case mp_pair_type: { mp_node p = mp_get_value_node(cur_exp_node); - if ( (mp_type(mp_x_part(p)) == mp_known_type) && - (mp_type(mp_y_part(p)) == mp_known_type) ) { + if ( (mp_x_part(p)->type == mp_known_type) && + (mp_y_part(p)->type == mp_known_type) ) { b = mp_true_operation; } } @@ -14551,16 +14548,16 @@ static void mp_pair_value (MP mp, mp_number *x, mp_number *y) memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); p = mp_new_value_node(mp); - new_expr.type = mp_type(p); + new_expr.type = p->type; new_expr.data.node = p; mp_flush_cur_exp(mp, new_expr); mp->cur_exp.type = mp_pair_type; - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp_init_pair_node(mp, p); p = mp_get_value_node(p); - mp_type(mp_x_part(p)) = mp_known_type; + mp_x_part(p)->type = mp_known_type; mp_set_value_number(mp_x_part(p), x1); - mp_type(mp_y_part(p)) = mp_known_type; + mp_y_part(p)->type = mp_known_type; mp_set_value_number(mp_y_part(p), y1); free_number(x1); free_number(y1); @@ -15147,11 +15144,11 @@ static void mp_do_unary (MP mp, int c) new_number(expr.data.n); if (mp->cur_exp.type != mp_picture_type) { set_number_from_boolean(expr.data.n, mp_false_operation); - } else if (mp_link(mp_edge_list(cur_exp_node)) == NULL) { + } else if (mp_edge_list(cur_exp_node)->link == NULL) { set_number_from_boolean(expr.data.n, mp_false_operation); } else { int type = c - mp_filled_operation + mp_fill_node_type; - set_number_from_boolean(expr.data.n, mp_type(mp_link(mp_edge_list(cur_exp_node))) == type ? mp_true_operation: mp_false_operation); + set_number_from_boolean(expr.data.n, mp_edge_list(cur_exp_node)->link->type == type ? mp_true_operation: mp_false_operation); } mp_flush_cur_exp(mp, expr); mp->cur_exp.type = mp_boolean_type; @@ -15383,7 +15380,7 @@ static void mp_bad_color_part (MP mp, int c) mp_string sname; memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); - p = mp_link(mp_edge_list(cur_exp_node)); + p = mp_edge_list(cur_exp_node)->link; mp_disp_err(mp, NULL); selector = mp->selector; mp->selector = mp_new_string_selector; @@ -15526,7 +15523,7 @@ static void mp_bad_binary (MP mp, mp_node p, int c) if (c >= mp_min_of_operation) { mp_print_op(mp, c); } - mp_print_known_or_unknown_type(mp, mp_type(p), p); + mp_print_known_or_unknown_type(mp, p->type, p); if (c >= mp_min_of_operation) { mp_print_str(mp, "of"); } else { @@ -15565,33 +15562,33 @@ static mp_node mp_tarnished (MP mp, mp_node p) { mp_node q = mp_get_value_node(p); (void) mp; - switch (mp_type(p)) { + switch (p->type) { case mp_pair_type: return ( - (mp_type(mp_x_part(q)) == mp_independent_type) || - (mp_type(mp_y_part(q)) == mp_independent_type) + (mp_x_part(q)->type == mp_independent_type) || + (mp_y_part(q)->type == mp_independent_type) ) ? MP_VOID : NULL; case mp_color_type: return ( - (mp_type(mp_red_part(q)) == mp_independent_type) || - (mp_type(mp_green_part(q)) == mp_independent_type) || - (mp_type(mp_blue_part(q)) == mp_independent_type) + (mp_red_part (q)->type == mp_independent_type) || + (mp_green_part(q)->type == mp_independent_type) || + (mp_blue_part (q)->type == mp_independent_type) ) ? MP_VOID : NULL; case mp_cmykcolor_type: return ( - (mp_type(mp_cyan_part(q)) == mp_independent_type) || - (mp_type(mp_magenta_part(q)) == mp_independent_type) || - (mp_type(mp_yellow_part(q)) == mp_independent_type) || - (mp_type(mp_black_part(q)) == mp_independent_type) + (mp_cyan_part (q)->type == mp_independent_type) || + (mp_magenta_part(q)->type == mp_independent_type) || + (mp_yellow_part (q)->type == mp_independent_type) || + (mp_black_part (q)->type == mp_independent_type) ) ? MP_VOID : NULL; case mp_transform_type: return ( - (mp_type(mp_tx_part(q)) == mp_independent_type) || - (mp_type(mp_ty_part(q)) == mp_independent_type) || - (mp_type(mp_xx_part(q)) == mp_independent_type) || - (mp_type(mp_xy_part(q)) == mp_independent_type) || - (mp_type(mp_yx_part(q)) == mp_independent_type) || - (mp_type(mp_yy_part(q)) == mp_independent_type) + (mp_tx_part(q)->type == mp_independent_type) || + (mp_ty_part(q)->type == mp_independent_type) || + (mp_xx_part(q)->type == mp_independent_type) || + (mp_xy_part(q)->type == mp_independent_type) || + (mp_yx_part(q)->type == mp_independent_type) || + (mp_yy_part(q)->type == mp_independent_type) ) ? MP_VOID : NULL; default: return NULL; @@ -15601,7 +15598,7 @@ static void mp_dep_finish (MP mp, mp_value_node v, mp_value_node q, int t) { mp_value_node p = (q == NULL) ? (mp_value_node) cur_exp_node : q; mp_set_dep_list(p, v); - mp_type(p) = t; + p->type = t; if (mp_get_dep_info(v) == NULL) { mp_number vv; new_number_clone(vv, mp_get_value_number(v)); @@ -15612,7 +15609,7 @@ static void mp_dep_finish (MP mp, mp_value_node v, mp_value_node q, int t) mp_flush_cur_exp(mp, new_expr); } else { mp_recycle_value(mp, (mp_node) p); - mp_type(q) = mp_known_type; + q->type = mp_known_type; mp_set_value_number(q, vv); } free_number(vv); @@ -15639,7 +15636,7 @@ static void mp_add_or_subtract (MP mp, mp_node p, mp_node q, int c) v = (mp_value_node) mp_get_dep_list((mp_value_node) cur_exp_node); } } else { - t = mp_type(q); + t = q->type; if (t < mp_dependent_type) { number_clone(vv, mp_get_value_number(q)); } else { @@ -15651,7 +15648,7 @@ static void mp_add_or_subtract (MP mp, mp_node p, mp_node q, int c) if (c == mp_minus_operation) { number_negate(vv); } - if (mp_type(p) == mp_known_type) { + if (p->type == mp_known_type) { slow_add(vv, mp_get_value_number(p), vv); if (q == NULL) { mp_set_cur_exp_value_number(mp, &vv); @@ -15663,34 +15660,34 @@ static void mp_add_or_subtract (MP mp, mp_node p, mp_node q, int c) } else { r = (mp_value_node) mp_get_dep_list((mp_value_node) p); while (mp_get_dep_info(r) != NULL) { - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; } slow_add(vv, mp_get_dep_value(r), vv); mp_set_dep_value(r, vv); if (qq == NULL) { qq = mp_get_dep_node(mp); mp_set_cur_exp_node(mp, (mp_node) qq); - mp->cur_exp.type = mp_type(p); - mp_name_type(qq) = mp_capsule_operation; + mp->cur_exp.type = p->type; + qq->name_type = mp_capsule_operation; } mp_set_dep_list(qq, mp_get_dep_list((mp_value_node) p)); - mp_type(qq) = mp_type(p); + qq->type = p->type; mp_set_prev_dep(qq, mp_get_prev_dep((mp_value_node) p)); - mp_link(mp_get_prev_dep((mp_value_node) p)) = (mp_node) qq; - mp_type(p) = mp_known_type; + mp_get_prev_dep((mp_value_node) p)->link = (mp_node) qq; + p->type = mp_known_type; } } else { if (c == mp_minus_operation) { mp_negate_dep_list(mp, v); } - if (mp_type(p) == mp_known_type) { + if (p->type == mp_known_type) { while (mp_get_dep_info(v) != NULL) { - v = (mp_value_node) mp_link(v); + v = (mp_value_node) v->link; } slow_add(vv, mp_get_value_number(p), mp_get_dep_value(v)); mp_set_dep_value(v, vv); } else { - s = mp_type(p); + s = p->type; r = (mp_value_node) mp_get_dep_list((mp_value_node) p); if (t == mp_dependent_type) { if (s == mp_dependent_type) { @@ -15734,7 +15731,7 @@ static void mp_dep_mult (MP mp, mp_value_node p, mp_number *v, int v_is_scaled) int s, t; if (p == NULL) { q = (mp_value_node) cur_exp_node; - } else if (mp_type(p) != mp_known_type) { + } else if (p->type != mp_known_type) { q = p; } else { mp_number r1, arg1; @@ -15751,7 +15748,7 @@ static void mp_dep_mult (MP mp, mp_value_node p, mp_number *v, int v_is_scaled) free_number(arg1); return; } - t = mp_type(q); + t = q->type; q = (mp_value_node) mp_get_dep_list(q); s = t; if (t == mp_dependent_type && v_is_scaled) { @@ -15774,7 +15771,7 @@ static void mp_hard_times (MP mp, mp_node p) mp_value_node pp; mp_number v; new_number(v); - if (mp_type(p) <= mp_pair_type) { + if (p->type <= mp_pair_type) { q = (mp_value_node) mp_stash_cur_exp(mp); mp_unstash_cur_exp(mp, p); p = (mp_node) q; @@ -15785,11 +15782,11 @@ static void mp_hard_times (MP mp, mp_node p) { mp_node r = mp_x_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_y_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); } break; @@ -15797,15 +15794,15 @@ static void mp_hard_times (MP mp, mp_node p) { mp_node r = mp_red_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_green_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_blue_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); } break; @@ -15813,19 +15810,19 @@ static void mp_hard_times (MP mp, mp_node p) { mp_node r = mp_cyan_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_yellow_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_magenta_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_black_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); } break; @@ -15840,7 +15837,7 @@ static void mp_dep_div (MP mp, mp_value_node p, mp_number *v) int s, t; if (p == NULL) { q = (mp_value_node) cur_exp_node; - } else if (mp_type(p) != mp_known_type) { + } else if (p->type != mp_known_type) { q = p; } else { mp_number ret; @@ -15850,7 +15847,7 @@ static void mp_dep_div (MP mp, mp_value_node p, mp_number *v) free_number(ret); return; } - t = mp_type(q); + t = q->type; q = (mp_value_node) mp_get_dep_list(q); s = t; if (t == mp_dependent_type) { @@ -15880,7 +15877,7 @@ static void mp_set_up_trans (MP mp, int c) q = mp_get_value_node(cur_exp_node); switch (c) { case mp_rotated_operation: - if (mp_type(p) == mp_known_type) { + if (p->type == mp_known_type) { mp_number n_sin, n_cos, arg1, arg2; new_fraction(n_sin); new_fraction(n_cos); @@ -15905,20 +15902,20 @@ static void mp_set_up_trans (MP mp, int c) } break; case mp_slanted_operation: - if (mp_type(p) > mp_pair_type) { + if (p->type > mp_pair_type) { mp_install(mp, mp_xy_part(q), p); goto DONE; } break; case mp_scaled_operation: - if (mp_type(p) > mp_pair_type) { + if (p->type > mp_pair_type) { mp_install(mp, mp_xx_part(q), p); mp_install(mp, mp_yy_part(q), p); goto DONE; } break; case mp_shifted_operation: - if (mp_type(p) == mp_pair_type) { + if (p->type == mp_pair_type) { r = mp_get_value_node(p); mp_install(mp, mp_tx_part(q), mp_x_part(r)); mp_install(mp, mp_ty_part(q), mp_y_part(r)); @@ -15926,25 +15923,25 @@ static void mp_set_up_trans (MP mp, int c) } break; case mp_x_scaled_operation: - if (mp_type(p) > mp_pair_type) { + if (p->type > mp_pair_type) { mp_install(mp, mp_xx_part(q), p); goto DONE; } break; case mp_y_scaled_operation: - if (mp_type(p) > mp_pair_type) { + if (p->type > mp_pair_type) { mp_install(mp, mp_yy_part(q), p); goto DONE; } break; case mp_z_scaled_operation: - if (mp_type(p) == mp_pair_type) { + if (p->type == mp_pair_type) { { r = mp_get_value_node(p); mp_install(mp, mp_xx_part(q), mp_x_part(r)); mp_install(mp, mp_yy_part(q), mp_x_part(r)); mp_install(mp, mp_yx_part(q), mp_y_part(r)); - if (mp_type(mp_y_part(r)) == mp_known_type) { + if (mp_y_part(r)->type == mp_known_type) { mp_set_value_number(mp_y_part(r), mp_get_value_number(mp_y_part(r))); number_negate(mp_get_value_number(mp_y_part(r))); } else { @@ -15971,12 +15968,12 @@ static void mp_set_up_trans (MP mp, int c) mp_free_value_node(mp, p); } q = mp_get_value_node(cur_exp_node); - if ( (mp_type(mp_tx_part(q)) == mp_known_type) && - (mp_type(mp_ty_part(q)) == mp_known_type) && - (mp_type(mp_xx_part(q)) == mp_known_type) && - (mp_type(mp_xy_part(q)) == mp_known_type) && - (mp_type(mp_yx_part(q)) == mp_known_type) && - (mp_type(mp_yy_part(q)) == mp_known_type) ) { + if ( (mp_tx_part(q)->type == mp_known_type) && + (mp_ty_part(q)->type == mp_known_type) && + (mp_xx_part(q)->type == mp_known_type) && + (mp_xy_part(q)->type == mp_known_type) && + (mp_yx_part(q)->type == mp_known_type) && + (mp_yy_part(q)->type == mp_known_type) ) { number_clone(mp->txx, mp_get_value_number(mp_xx_part(q))); number_clone(mp->txy, mp_get_value_number(mp_xy_part(q))); number_clone(mp->tyx, mp_get_value_number(mp_yx_part(q))); @@ -16065,7 +16062,7 @@ static void mp_do_path_pen_trans (MP mp, mp_shape_node p, mp_number *sqdet, int set_number_to_zero(mp->tx); set_number_to_zero(mp->ty); mp_do_pen_trans(mp, mp_pen_ptr(p)); - if (number_nonzero(*sqdet) && ((mp_type(p) == mp_stroked_node_type) && (mp_dash_ptr(p) != NULL))) { + if (number_nonzero(*sqdet) && ((p->type == mp_stroked_node_type) && (mp_dash_ptr(p) != NULL))) { mp_number ret; new_number(ret); take_scaled(ret, ((mp_shape_node) p)->dashscale, *sqdet); @@ -16103,9 +16100,9 @@ static mp_edge_header_node mp_edges_trans (MP mp, mp_edge_header_node h) mp_set_dash_list(h, mp->null_dash); while (r != mp->null_dash) { s = r; - r = (mp_dash_node) mp_link(r); + r = (mp_dash_node) r->link; number_swap(s->start_x, s->stop_x ); - mp_link(s) = (mp_node) mp_get_dash_list(h); + s->link = (mp_node) mp_get_dash_list(h); mp_set_dash_list(h, s); } } @@ -16119,7 +16116,7 @@ static mp_edge_header_node mp_edges_trans (MP mp, mp_edge_header_node h) set_number_from_addition(r->start_x, arg1, mp->tx); take_scaled(arg1, r->stop_x, mp->txx); set_number_from_addition(r->stop_x, arg1, mp->tx); - r = (mp_dash_node) mp_link(r); + r = (mp_dash_node) r->link; } free_number(arg1); } @@ -16164,9 +16161,9 @@ static mp_edge_header_node mp_edges_trans (MP mp, mp_edge_header_node h) free_number(tot); } DONE1: - q = mp_link(mp_edge_list(h)); + q = mp_edge_list(h)->link; while (q != NULL) { - switch (mp_type(q)) { + switch (q->type) { case mp_fill_node_type: case mp_stroked_node_type: mp_do_path_trans(mp, mp_path_ptr((mp_shape_node) q)); @@ -16184,7 +16181,7 @@ static mp_edge_header_node mp_edges_trans (MP mp, mp_edge_header_node h) default: break; } - q = mp_link(q); + q = q->link; } free_number(sqdet); return h; @@ -16213,39 +16210,39 @@ static void mp_bilin1 (MP mp, mp_node p, mp_number *t, mp_node q, mp_number *u, mp_dep_mult(mp, (mp_value_node) p, t, 1); } if (number_nonzero(*u)) { - if (mp_type(q) == mp_known_type) { + if (q->type == mp_known_type) { mp_number tmp; new_number(tmp); take_scaled(tmp, mp_get_value_number(q), *u); number_add(delta, tmp); free_number(tmp); } else { - if (mp_type(p) != mp_proto_dependent_type) { - if (mp_type(p) == mp_known_type) { - mp_new_dep(mp, p, mp_type(p), mp_const_dependency(mp, &(mp_get_value_number(p)))); + if (p->type != mp_proto_dependent_type) { + if (p->type == mp_known_type) { + mp_new_dep(mp, p, p->type, mp_const_dependency(mp, &(mp_get_value_number(p)))); } else { mp_set_dep_list((mp_value_node) p, mp_p_times_v(mp, (mp_value_node) mp_get_dep_list((mp_value_node) p), &unity_t, mp_dependent_type, mp_proto_dependent_type, 1)); } - mp_type(p) = mp_proto_dependent_type; + p->type = mp_proto_dependent_type; } mp_set_dep_list((mp_value_node) p, mp_p_plus_fq(mp, (mp_value_node) mp_get_dep_list((mp_value_node) p), u, (mp_value_node) mp_get_dep_list((mp_value_node) q), - mp_proto_dependent_type, mp_type(q))); + mp_proto_dependent_type, q->type)); } } - if (mp_type(p) == mp_known_type) { + if (p->type == mp_known_type) { mp_set_value_number(p, mp_get_value_number(p)); number_add(mp_get_value_number(p), delta); } else { mp_number tmp; mp_value_node r = (mp_value_node) mp_get_dep_list((mp_value_node) p); while (mp_get_dep_info(r) != NULL) { - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; } new_number_clone(tmp, mp_get_value_number(r)); number_add(delta, tmp); @@ -16254,7 +16251,7 @@ static void mp_bilin1 (MP mp, mp_node p, mp_number *t, mp_node q, mp_number *u, mp_set_value_number(r, delta); } else { mp_recycle_value(mp, p); - mp_type(p) = mp_known_type; + p->type = mp_known_type; mp_set_value_number(p, delta); } free_number(tmp); @@ -16266,7 +16263,7 @@ static void mp_bilin1 (MP mp, mp_node p, mp_number *t, mp_node q, mp_number *u, } static void mp_add_mult_dep (MP mp, mp_value_node p, mp_number *v, mp_node r) { - if (mp_type(r) == mp_known_type) { + if (r->type == mp_known_type) { mp_number ret; new_number(ret); take_scaled(ret, mp_get_value_number(r), *v); @@ -16274,7 +16271,7 @@ static void mp_add_mult_dep (MP mp, mp_value_node p, mp_number *v, mp_node r) number_add(mp_get_dep_value(mp->dep_final), ret); free_number(ret); } else { - mp_set_dep_list(p, mp_p_plus_fq(mp, (mp_value_node) mp_get_dep_list(p), v, (mp_value_node) mp_get_dep_list((mp_value_node) r), mp_proto_dependent_type, mp_type(r))); + mp_set_dep_list(p, mp_p_plus_fq(mp, (mp_value_node) mp_get_dep_list(p), v, (mp_value_node) mp_get_dep_list((mp_value_node) r), mp_proto_dependent_type, r->type)); if (mp->fix_needed) { mp_fix_dependencies(mp); } @@ -16300,7 +16297,7 @@ static void mp_bilin2 (MP mp, mp_node p, mp_node t, mp_number *v, mp_node u, mp_ if (mp_get_dep_list((mp_value_node) p) == (mp_node) mp->dep_final) { number_clone(vv, mp_get_dep_value(mp->dep_final)); mp_recycle_value(mp, p); - mp_type(p) = mp_known_type; + p->type = mp_known_type; mp_set_value_number(p, vv); } free_number(vv); @@ -16334,13 +16331,13 @@ static void mp_bilin3 (MP mp, mp_node p, mp_number *t, mp_number *v, mp_number * static void mp_big_trans (MP mp, mp_node p, int c) { mp_node q = mp_get_value_node(p); - if (mp_type(q) == mp_pair_node_type) { - if (mp_type(mp_x_part(q)) != mp_known_type || mp_type(mp_y_part(q)) != mp_known_type) { + if (q->type == mp_pair_node_type) { + if (mp_x_part(q)->type != mp_known_type || mp_y_part(q)->type != mp_known_type) { goto UNKNOWN; } - } else if (mp_type(mp_tx_part(q)) != mp_known_type || mp_type(mp_ty_part(q)) != mp_known_type || - mp_type(mp_xx_part(q)) != mp_known_type || mp_type(mp_xy_part(q)) != mp_known_type || - mp_type(mp_yx_part(q)) != mp_known_type || mp_type(mp_yy_part(q)) != mp_known_type) { + } else if (mp_tx_part(q)->type != mp_known_type || mp_ty_part(q)->type != mp_known_type || + mp_xx_part(q)->type != mp_known_type || mp_xy_part(q)->type != mp_known_type || + mp_yx_part(q)->type != mp_known_type || mp_yy_part(q)->type != mp_known_type) { goto UNKNOWN; } { @@ -16723,7 +16720,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) mp_print_str(mp, ")}"); mp_end_diagnostic(mp, 0); } - switch (mp_type(p)) { + switch (p->type) { case mp_transform_type: case mp_color_type: case mp_cmykcolor_type: @@ -16765,12 +16762,12 @@ static void mp_do_binary (MP mp, mp_node p, int c) switch (c) { case mp_plus_operation: case mp_minus_operation: - if ((mp->cur_exp.type < mp_color_type) || (mp_type(p) < mp_color_type)) { + if ((mp->cur_exp.type < mp_color_type) || (p->type < mp_color_type)) { mp_bad_binary(mp, p, c); } else { - if ((mp->cur_exp.type > mp_pair_type) && (mp_type(p) > mp_pair_type)) { + if ((mp->cur_exp.type > mp_pair_type) && (p->type > mp_pair_type)) { mp_add_or_subtract(mp, p, NULL, c); - } else if (mp->cur_exp.type != mp_type(p)) { + } else if (mp->cur_exp.type != p->type) { mp_bad_binary(mp, p, c); } else { @@ -16813,9 +16810,9 @@ static void mp_do_binary (MP mp, mp_node p, int c) case mp_equal_operation: case mp_unequal_operation: check_arith(); - if ((mp->cur_exp.type > mp_pair_type) && (mp_type(p) > mp_pair_type)) { + if ((mp->cur_exp.type > mp_pair_type) && (p->type > mp_pair_type)) { mp_add_or_subtract(mp, p, NULL, mp_minus_operation); - } else if (mp->cur_exp.type != mp_type(p)) { + } else if (mp->cur_exp.type != p->type) { mp_bad_binary(mp, p, (int) c); goto DONE; } else { @@ -16852,13 +16849,13 @@ static void mp_do_binary (MP mp, mp_node p, int c) mp_node rr = mp_x_part(r); part_type = mp_x_part_operation; mp_add_or_subtract(mp, mp_x_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_y_part(r); part_type = mp_y_part_operation; mp_add_or_subtract(mp, mp_y_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } } @@ -16874,19 +16871,19 @@ static void mp_do_binary (MP mp, mp_node p, int c) mp_node rr = mp_red_part(r); part_type = mp_red_part_operation; mp_add_or_subtract(mp, mp_red_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_green_part(r); part_type = mp_green_part_operation; mp_add_or_subtract(mp, mp_green_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_blue_part(r); part_type = mp_blue_part_operation; mp_add_or_subtract(mp, mp_blue_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } } @@ -16902,25 +16899,25 @@ static void mp_do_binary (MP mp, mp_node p, int c) mp_node rr = mp_cyan_part(r); part_type = mp_cyan_part_operation; mp_add_or_subtract(mp, mp_cyan_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_magenta_part(r); part_type = mp_magenta_part_operation; mp_add_or_subtract(mp, mp_magenta_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_yellow_part(r); part_type = mp_yellow_part_operation; mp_add_or_subtract(mp, mp_yellow_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_black_part(r); part_type = mp_black_part_operation; mp_add_or_subtract(mp, mp_black_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } } @@ -16936,37 +16933,37 @@ static void mp_do_binary (MP mp, mp_node p, int c) mp_node rr = mp_tx_part(r); part_type = mp_x_part_operation; mp_add_or_subtract(mp, mp_tx_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_ty_part(r); part_type = mp_y_part_operation; mp_add_or_subtract(mp, mp_ty_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_xx_part(r); part_type = mp_xx_part_operation; mp_add_or_subtract(mp, mp_xx_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_xy_part(r); part_type = mp_xy_part_operation; mp_add_or_subtract(mp, mp_xy_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_yx_part(r); part_type = mp_yx_part_operation; mp_add_or_subtract(mp, mp_yx_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_yy_part(r); part_type = mp_yy_part_operation; mp_add_or_subtract(mp, mp_yy_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } } @@ -17034,19 +17031,19 @@ static void mp_do_binary (MP mp, mp_node p, int c) break; case mp_and_operation: case mp_or_operation: - if ((mp_type(p) != mp_boolean_type) || (mp->cur_exp.type != mp_boolean_type)) { + if ((p->type != mp_boolean_type) || (mp->cur_exp.type != mp_boolean_type)) { mp_bad_binary(mp, p, (int) c); } else if (number_to_boolean(p->data.n) == c + mp_false_operation - mp_and_operation) { mp_set_cur_exp_value_boolean(mp, number_to_boolean(p->data.n)); } break; case mp_times_operation: - if ((mp->cur_exp.type < mp_color_type) || (mp_type(p) < mp_color_type)) { + if ((mp->cur_exp.type < mp_color_type) || (p->type < mp_color_type)) { mp_bad_binary(mp, p, mp_times_operation); - } else if ((mp->cur_exp.type == mp_known_type) || (mp_type(p) == mp_known_type)) { + } else if ((mp->cur_exp.type == mp_known_type) || (p->type == mp_known_type)) { mp_number vv; new_fraction(vv); - if (mp_type(p) == mp_known_type) { + if (p->type == mp_known_type) { number_clone(vv, mp_get_value_number(p)); mp_free_value_node(mp, p); } else { @@ -17093,8 +17090,8 @@ static void mp_do_binary (MP mp, mp_node p, int c) free_number(vv); mp_finish_binary(mp, old_p, old_exp); return; - } else if ((mp_nice_color_or_pair(mp, p, mp_type(p)) && (mp->cur_exp.type > mp_pair_type)) - || (mp_nice_color_or_pair(mp, cur_exp_node, mp->cur_exp.type) && (mp_type(p) > mp_pair_type))) { + } else if ((mp_nice_color_or_pair(mp, p, p->type) && (mp->cur_exp.type > mp_pair_type)) + || (mp_nice_color_or_pair(mp, cur_exp_node, mp->cur_exp.type) && (p->type > mp_pair_type))) { mp_hard_times(mp, p); mp_finish_binary(mp, old_p, old_exp); return; @@ -17103,7 +17100,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) } break; case mp_over_operation: - if ((mp->cur_exp.type != mp_known_type) || (mp_type(p) < mp_color_type)) { + if ((mp->cur_exp.type != mp_known_type) || (p->type < mp_color_type)) { mp_bad_binary(mp, p, mp_over_operation); } else { mp_number v_n; @@ -17163,7 +17160,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) } break; case mp_power_operation: - if ((mp->cur_exp.type == mp_known_type) && (mp_type(p) == mp_known_type)) { + if ((mp->cur_exp.type == mp_known_type) && (p->type == mp_known_type)) { mp_number r; new_number(r); power_of(r, mp_get_value_number(p), cur_exp_value_number); @@ -17175,7 +17172,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) break; case mp_pythag_add_operation: case mp_pythag_sub_operation: - if ((mp->cur_exp.type == mp_known_type) && (mp_type(p) == mp_known_type)) { + if ((mp->cur_exp.type == mp_known_type) && (p->type == mp_known_type)) { mp_number r; new_number(r); if (c == mp_pythag_add_operation) { @@ -17196,7 +17193,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) case mp_x_scaled_operation: case mp_y_scaled_operation: case mp_z_scaled_operation: - switch (mp_type(p)) { + switch (p->type) { case mp_path_type: mp_set_up_known_trans(mp, (int) c); mp_unstash_cur_exp(mp, p); @@ -17234,7 +17231,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) case mp_just_append_operation: case mp_tolerant_concat_operation: case mp_tolerant_append_operation: - if ((mp->cur_exp.type == mp_string_type) && (mp_type(p) == mp_string_type)) { + if ((mp->cur_exp.type == mp_string_type) && (p->type == mp_string_type)) { mp_string str = mp_cat(mp, mp_get_value_str(p), cur_exp_str); delete_str_ref(cur_exp_str) ; mp_set_cur_exp_str(mp, str); @@ -17243,7 +17240,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) } break; case mp_substring_operation: - if (mp_nice_pair(mp, p, mp_type(p)) && (mp->cur_exp.type == mp_string_type)) { + if (mp_nice_pair(mp, p, p->type) && (mp->cur_exp.type == mp_string_type)) { mp_string str = mp_chop_string (mp, cur_exp_str, round_unscaled(mp_get_value_number(mp_x_part(mp_get_value_node(p)))), @@ -17259,7 +17256,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if (mp_nice_pair(mp, p, mp_type(p)) && (mp->cur_exp.type == mp_path_type)) { + if (mp_nice_pair(mp, p, p->type) && (mp->cur_exp.type == mp_path_type)) { mp_chop_path(mp, mp_get_value_node(p)); } else { mp_bad_binary(mp, p, mp_subpath_operation); @@ -17272,14 +17269,14 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && (mp_type(p) == mp_known_type)) { + if ((mp->cur_exp.type == mp_path_type) && (p->type == mp_known_type)) { mp_find_point(mp, &(mp_get_value_number(p)), (int) c); } else { mp_bad_binary(mp, p, c); } break; case mp_pen_offset_operation: - if ((mp->cur_exp.type == mp_pen_type || mp->cur_exp.type == mp_nep_type) && mp_nice_pair(mp, p, mp_type(p))) { + if ((mp->cur_exp.type == mp_pen_type || mp->cur_exp.type == mp_nep_type) && mp_nice_pair(mp, p, p->type)) { mp_set_up_offset(mp, mp_get_value_node(p)); } else { mp_bad_binary(mp, p, mp_pen_offset_operation); @@ -17289,21 +17286,21 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && mp_nice_pair(mp, p, mp_type(p))) { + if ((mp->cur_exp.type == mp_path_type) && mp_nice_pair(mp, p, p->type)) { mp_set_up_direction_time(mp, mp_get_value_node(p)); } else { mp_bad_binary(mp, p, mp_direction_time_operation); } break; case mp_envelope_operation: - if ((mp_type(p) != mp_pen_type && mp_type(p) != mp_nep_type) || (mp->cur_exp.type != mp_path_type)) { + if ((p->type != mp_pen_type && p->type != mp_nep_type) || (mp->cur_exp.type != mp_path_type)) { mp_bad_binary(mp, p, mp_envelope_operation); } else { mp_set_up_envelope(mp, p); } break; case mp_boundingpath_operation: - if ((mp_type(p) != mp_pen_type && mp_type(p) != mp_nep_type) || (mp->cur_exp.type != mp_path_type)) { + if ((p->type != mp_pen_type && p->type != mp_nep_type) || (mp->cur_exp.type != mp_path_type)) { mp_bad_binary(mp, p, mp_boundingpath_operation); } else { mp_set_up_boundingpath(mp, p); @@ -17313,7 +17310,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && (mp_type(p) == mp_known_type)) { + if ((mp->cur_exp.type == mp_path_type) && (p->type == mp_known_type)) { memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); mp_get_arc_time(mp, &new_expr.data.n, cur_exp_knot, &(mp_get_value_number(p)), 0); @@ -17326,11 +17323,11 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && (mp_type(p) == mp_known_type || mp_type(p) == mp_pair_type)) { + if ((mp->cur_exp.type == mp_path_type) && (p->type == mp_known_type || p->type == mp_pair_type)) { mp_knot k; memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); - if (mp_type(p) == mp_pair_type) { + if (p->type == mp_pair_type) { mp_knot f = cur_exp_knot; mp_node q = mp_get_value_node(p); mp_number x; @@ -17376,7 +17373,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && mp_type(p) == mp_known_type) { + if ((mp->cur_exp.type == mp_path_type) && p->type == mp_known_type) { mp_knot cur = cur_exp_knot; mp_number len, aln, seg, tot, tim, stp, acc, tmp; @@ -17471,7 +17468,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && mp_type(p) == mp_pair_type) { + if ((mp->cur_exp.type == mp_path_type) && p->type == mp_pair_type) { memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); mp_node q = mp_get_value_node(p); @@ -17483,7 +17480,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) break; case mp_intertimes_operation: case mp_intertimes_list_operation: - if (mp_type(p) == mp_pair_type) { + if (p->type == mp_pair_type) { mp_node q = mp_stash_cur_exp(mp); mp_unstash_cur_exp(mp, p); mp_pair_to_path(mp); @@ -17493,7 +17490,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && (mp_type(p) == mp_path_type)) { + if ((mp->cur_exp.type == mp_path_type) && (p->type == mp_path_type)) { if (c == mp_intertimes_operation) { mp_path_intersection(mp, mp_get_value_knot(p), cur_exp_knot, 0, NULL); @@ -17800,7 +17797,7 @@ void mp_do_equation (MP mp) trace_equation(mp, lhs); } if (mp->cur_exp.type == mp_unknown_path_type) { - if (mp_type(lhs) == mp_pair_type) { + if (lhs->type == mp_pair_type) { mp_node p; p = mp_stash_cur_exp(mp); mp_unstash_cur_exp(mp, lhs); @@ -17910,7 +17907,7 @@ static void trace_assignment (MP mp, mp_node lhs) { mp_begin_diagnostic(mp); mp_print_nl(mp, "{"); - if (mp_name_type(lhs) == mp_internal_operation) { + if (lhs->name_type == mp_internal_operation) { mp_print_str(mp, internal_name(mp_get_sym_info(lhs))); } else { mp_show_token_list(mp, lhs, NULL); @@ -17939,7 +17936,7 @@ void mp_do_assignment (MP mp) if (number_greater(internal_value(mp_tracing_commands_internal), two_t)) { trace_assignment (mp, lhs); } - if (mp_name_type(lhs) == mp_internal_operation) { + if (lhs->name_type == mp_internal_operation) { switch (mp->cur_exp.type) { case mp_known_type: case mp_string_type: @@ -17987,7 +17984,7 @@ void mp_do_assignment (MP mp) mp_node q = mp_stash_cur_exp(mp); mp->cur_exp.type = mp_und_type(mp, p); mp_recycle_value(mp, p); - mp_type(p) = mp->cur_exp.type; + p->type = mp->cur_exp.type; mp_set_value_number(p, zero_t); mp_make_exp_copy(mp, p); p = mp_stash_cur_exp(mp); @@ -18006,7 +18003,7 @@ static void announce_bad_equation (MP mp, mp_node lhs) char msg[256]; mp_snprintf(msg, 256, "Equation cannot be performed (%s=%s)", - (mp_type(lhs) <= mp_pair_type ? mp_type_string(mp_type(lhs)) : "numeric"), + (lhs->type <= mp_pair_type ? mp_type_string(lhs->type) : "numeric"), (mp->cur_exp.type <= mp_pair_type ? mp_type_string(mp->cur_exp.type) : "numeric")); mp_disp_err(mp, lhs); mp_disp_err(mp, NULL); @@ -18068,7 +18065,7 @@ void mp_make_eq (MP mp, mp_node lhs) memset(&new_expr, 0, sizeof(mp_value)); new_number(v); RESTART: - t = mp_type(lhs); + t = lhs->type; if (t <= mp_pair_type) { number_clone(v, mp_get_value_number(lhs)); } @@ -18211,7 +18208,7 @@ void mp_try_eq (MP mp, mp_node l, mp_node r) mp_value_node pp; mp_variable_type tt; int copied; - mp_variable_type t = mp_type(l); + mp_variable_type t = l->type; switch (t) { case mp_known_type: { @@ -18242,12 +18239,12 @@ void mp_try_eq (MP mp, mp_node l, mp_node r) if (mp_get_dep_info(q) == NULL) { break; } else { - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; } } - mp_link(mp_get_prev_dep(ll)) = mp_link(q); - mp_set_prev_dep((mp_value_node) mp_link(q), mp_get_prev_dep(ll)); - mp_type(ll) = mp_known_type; + mp_get_prev_dep(ll)->link = q->link; + mp_set_prev_dep((mp_value_node) q->link, mp_get_prev_dep(ll)); + ll->type = mp_known_type; } break; } @@ -18263,11 +18260,11 @@ void mp_try_eq (MP mp, mp_node l, mp_node r) pp = (mp_value_node) mp_get_dep_list((mp_value_node) cur_exp_node); } } - } else if (mp_type(r) == mp_known_type) { + } else if (r->type == mp_known_type) { number_add(mp_get_dep_value(q), mp_get_value_number(r)); goto DONE1; } else { - tt = mp_type(r); + tt = r->type; if (tt == mp_independent_type) { pp = mp_single_dependency(mp, r); } else { @@ -18293,7 +18290,7 @@ void mp_try_eq (MP mp, mp_node l, mp_node r) number_clone(x, mp_get_dep_value(q)); fraction_to_round_scaled(x); mp_set_dep_value(q, x); - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; } free_number(x); t = mp_proto_dependent_type; @@ -18308,7 +18305,7 @@ void mp_try_eq (MP mp, mp_node l, mp_node r) deal_with_redundant_or_inconsistent_equation(mp, p, r); } else { mp_linear_eq(mp, p, (int) t); - if (r == NULL && mp->cur_exp.type != mp_known_type && mp_type(cur_exp_node) == mp_known_type) { + if (r == NULL && mp->cur_exp.type != mp_known_type && cur_exp_node->type == mp_known_type) { mp_node pp = cur_exp_node; mp_set_cur_exp_value_number(mp, &(mp_get_value_number(pp))); mp->cur_exp.type = mp_known_type; @@ -18351,10 +18348,10 @@ mp_node mp_scan_declared_variable (MP mp) } } } - mp_link(t) = mp_new_symbolic_node(mp); - t = mp_link(t); + t->link = mp_new_symbolic_node(mp); + t = t->link; mp_set_sym_sym(t, cur_sym); - mp_name_type(t) = cur_sym_mod; + t->name_type = cur_sym_mod; } if (eq_property(x) != 0) { mp_check_overload(mp, x); @@ -18389,10 +18386,10 @@ void mp_do_type_declaration (MP mp) do { mp_node p = mp_scan_declared_variable(mp); mp_node q; - mp_flush_variable(mp, equiv_node(mp_get_sym_sym(p)), mp_link(p), 0); + mp_flush_variable(mp, equiv_node(mp_get_sym_sym(p)), p->link, 0); q = mp_find_variable(mp, p); if (q != NULL) { - mp_type(q) = t; + q->type = t; mp_set_value_number(q, zero_t); } else { mp_back_error( @@ -18993,26 +18990,26 @@ void mp_do_show_stats (MP mp) void mp_disp_var (MP mp, mp_node p) { - if (mp_type(p) == mp_structured_type) { + if (p->type == mp_structured_type) { mp_node q = mp_get_attribute_head(p); do { mp_disp_var(mp, q); - q = mp_link(q); + q = q->link; } while (q != mp->end_attr); q = mp_get_subscr_head(p); - while (mp_name_type(q) == mp_subscript_operation) { + while (q->name_type == mp_subscript_operation) { mp_disp_var(mp, q); - q = mp_link(q); + q = q->link; } - } else if (mp_type(p) >= mp_unsuffixed_macro_type) { + } else if (p->type >= mp_unsuffixed_macro_type) { mp_print_nl(mp, ""); mp_print_variable_name(mp, p); - if (mp_type(p) > mp_unsuffixed_macro_type) { + if (p->type > mp_unsuffixed_macro_type) { mp_print_str(mp, "@#"); } mp_print_str(mp, "=macro:"); mp_show_macro(mp, mp_get_value_node(p), NULL); - } else if (mp_type(p) != mp_undefined_type) { + } else if (p->type != mp_undefined_type) { mp_print_nl(mp, ""); mp_print_variable_name(mp, p); mp_print_chr(mp, '='); @@ -19038,22 +19035,23 @@ void mp_do_show_var (MP mp) void mp_do_show_dependencies (MP mp) { - mp_value_node p = (mp_value_node) mp_link(mp->dep_head); + mp_value_node p = (mp_value_node) mp->dep_head->link; while (p != mp->dep_head) { if (mp_interesting(mp, (mp_node) p)) { mp_print_nl(mp, ""); mp_print_variable_name(mp, (mp_node) p); - if (mp_type(p) == mp_dependent_type) { + if (p->type == mp_dependent_type) { mp_print_chr(mp, '='); } else { mp_print_str(mp, " = "); } - mp_print_dependency(mp, (mp_value_node) mp_get_dep_list(p), mp_type(p)); + mp_print_dependency(mp, (mp_value_node) mp_get_dep_list(p), p->type); } p = (mp_value_node) mp_get_dep_list(p); - while (mp_get_dep_info(p) != NULL) - p = (mp_value_node) mp_link(p); - p = (mp_value_node) mp_link(p); + while (mp_get_dep_info(p) != NULL) { + p = (mp_value_node) p->link; + } + p = (mp_value_node) p->link; } mp_get_x_next(mp); } @@ -19356,12 +19354,12 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) if (mp_has_pen(pp)) { break; } else { - pp = mp_link(pp); + pp = pp->link; } } } if (pp != NULL) { - switch (mp_type(pp)) { + switch (pp->type) { case mp_fill_node_type: case mp_stroked_node_type: if (mp_pen_ptr((mp_shape_node) pp) != NULL) { @@ -19386,7 +19384,7 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) ap = p; } while ((ap != NULL) && (! mp_has_script(ap))) { - ap = mp_link(ap); + ap = ap->link; } if (ap != NULL) { if (mp_pre_script(ap) != NULL) { @@ -19418,7 +19416,7 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) bp = p; } while ((bp != NULL) && (! mp_has_script(bp))) { - bp = mp_link(bp); + bp = bp->link; } if (bp != NULL) { if (mp_post_script(bp) != NULL) { @@ -19545,10 +19543,10 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) if (dp == MP_VOID) { dp = p; while (dp != NULL) { - if (mp_type(dp) == mp_stroked_node_type) { + if (dp->type == mp_stroked_node_type) { break; } else { - dp = mp_link(dp); + dp = dp->link; } } } @@ -19564,7 +19562,7 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) } } if (cp > MP_VOID) { - mp_node q = mp_link(cp); + mp_node q = cp->link; while (q != NULL) { if (mp_has_color(q)) { mp_shape_node q0 = (mp_shape_node) q; @@ -19575,14 +19573,14 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) number_clone(q0->black, cp0->black); mp_color_model(q) = mp_color_model(cp); } - q = mp_link(q); + q = q->link; } } if (pp > MP_VOID) { - mp_node q = mp_link(pp); + mp_node q = pp->link; while (q != NULL) { if (mp_has_pen(q)) { - switch (mp_type(q)) { + switch (q->type) { case mp_fill_node_type: case mp_stroked_node_type: if (mp_pen_ptr((mp_shape_node) q) != NULL) { @@ -19594,13 +19592,13 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) break; } } - q = mp_link(q); + q = q->link; } } if (dp > MP_VOID) { - mp_node q = mp_link(dp); + mp_node q = dp->link; while (q != NULL) { - if (mp_type(q) == mp_stroked_node_type) { + if (q->type == mp_stroked_node_type) { if (mp_dash_ptr(q) != NULL) { mp_delete_edge_ref(mp, mp_dash_ptr(q)); } @@ -19610,13 +19608,13 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) mp_add_edge_ref(mp, mp_dash_ptr(q)); } } - q = mp_link(q); + q = q->link; } } if (linecap >= 0 && linecap < mp_weird_linecap_code) { mp_node q = p; while (q != NULL) { - switch (mp_type(q)) { + switch (q->type) { case mp_fill_node_type: case mp_stroked_node_type: mp_set_linecap(q, linecap); @@ -19624,13 +19622,13 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) default: break; } - q = mp_link(q); + q = q->link; } } if (linejoin >= 0 && linejoin < mp_weird_linejoin_code) { mp_node q = p; while (q != NULL) { - switch (mp_type(q)) { + switch (q->type) { case mp_fill_node_type: case mp_stroked_node_type: mp_set_linejoin(q, linejoin); @@ -19638,13 +19636,13 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) default: break; } - q = mp_link(q); + q = q->link; } } if (miterlimit) { mp_node q = p; while (q != NULL) { - switch (mp_type(q)) { + switch (q->type) { case mp_fill_node_type: case mp_stroked_node_type: number_clone(mp_miterlimit(q), ml); @@ -19652,15 +19650,15 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) default: break; } - q = mp_link(q); + q = q->link; } free_number(ml); } if (! pp && sp > MP_VOID) { - mp_node q = mp_link(sp); + mp_node q = sp->link; while (q != NULL) { mp_stacking(q) = mp_stacking(sp); - q = mp_link(q); + q = q->link; } } } @@ -19681,7 +19679,7 @@ mp_edge_header_node mp_find_edges_var (MP mp, mp_node t) ); mp_memory_free(msg); mp_get_x_next(mp); - } else if (mp_type(p) != mp_picture_type) { + } else if (p->type != mp_picture_type) { char msg[256]; mp_string sname; int selector = mp->selector; @@ -19689,7 +19687,7 @@ mp_edge_header_node mp_find_edges_var (MP mp, mp_node t) mp_show_token_list(mp, t, NULL); sname = mp_make_string(mp); mp->selector = selector; - mp_snprintf(msg, 256, "Variable %s is the wrong type(%s)", mp_str(mp, sname), mp_type_string(mp_type(p))); + mp_snprintf(msg, 256, "Variable %s is the wrong type(%s)", mp_str(mp, sname), mp_type_string(p->type)); delete_str_ref(sname); mp_back_error( mp, @@ -19783,12 +19781,12 @@ void mp_do_bounds (MP mp) } pp = mp_new_bounds_node(mp, NULL, mm); mp_scan_with_list(mp, p, pp); - mp_link(p) = mp_link(mp_edge_list(lhe)); - mp_link(mp_edge_list(lhe)) = p; + p->link = mp_edge_list(lhe)->link; + mp_edge_list(lhe)->link = p; if (mp_obj_tail(lhe) == mp_edge_list(lhe)) { mp_obj_tail(lhe) = p; } - mp_link(mp_obj_tail(lhe)) = pp; + mp_obj_tail(lhe)->link = pp; mp_obj_tail(lhe) = pp; mp_init_bbox(mp, lhe); } @@ -19822,7 +19820,7 @@ void mp_do_add_to (MP mp) } else { e = mp_private_edges(mp, (mp_edge_header_node) cur_exp_node); mp->cur_exp.type = mp_vacuous_type; - p = mp_link(mp_edge_list(e)); + p = mp_edge_list(e)->link; } } else { e = NULL; @@ -19870,17 +19868,17 @@ void mp_do_add_to (MP mp) } } else if (add_type == mp_add_also_code) { if (e != NULL) { - if (mp_link(mp_edge_list(e)) != NULL) { - mp_link(mp_obj_tail(lhe)) = mp_link(mp_edge_list(e)); + if (mp_edge_list(e)->link != NULL) { + mp_obj_tail(lhe)->link = mp_edge_list(e)->link; mp_obj_tail(lhe) = mp_obj_tail(e); mp_obj_tail(e) = mp_edge_list(e); - mp_link(mp_edge_list(e)) = NULL; + mp_edge_list(e)->link = NULL; mp_flush_dash_list(mp, lhe); } mp_toss_edges(mp, e); } } else if (p != NULL) { - mp_link(mp_obj_tail(lhe)) = p; + mp_obj_tail(lhe)->link = p; mp_obj_tail(lhe) = p; if (add_type == mp_add_double_path_code) { if (mp_pen_ptr((mp_shape_node) p) == NULL) { @@ -20081,10 +20079,10 @@ struct mp_edge_object *mp_gr_export (MP mp, mp_edge_header_node h) hh->height = number_to_double(internal_value(mp_char_ht_internal)); hh->depth = number_to_double(internal_value(mp_char_dp_internal)); hh->italic = number_to_double(internal_value(mp_char_ic_internal)); - p = mp_link(mp_edge_list(h)); + p = mp_edge_list(h)->link; while (p != NULL) { - mp_graphic_object *hq = mp_new_graphic_object(mp, (int) ((mp_type(p) - mp_fill_node_type) + 1)); - switch (mp_type(p)) { + mp_graphic_object *hq = mp_new_graphic_object(mp, (int) ((p->type - mp_fill_node_type) + 1)); + switch (p->type) { case mp_fill_node_type: { mp_number d_width; @@ -20175,7 +20173,7 @@ struct mp_edge_object *mp_gr_export (MP mp, mp_edge_header_node h) gr_link(hp) = hq; } hp = hq; - p = mp_link(p); + p = p->link; } return hh; } @@ -20299,15 +20297,15 @@ void mp_scan_symbol_value (MP mp, int keep, char **s, int expand) unsigned char *r = NULL; mp_node p = mp_new_symbolic_node(mp); mp_set_sym_sym(p, cur_sym); - mp_name_type(p) = cur_sym_mod; - if (mp_type(p) == mp_symbol_node_type) { + p->name_type = cur_sym_mod; + if (p->type == mp_symbol_node_type) { mp_sym sr = mp_get_sym_sym(p); mp_string rr = text(sr); if (rr && rr->str) { r = rr->str; } - } else if (mp_name_type(p) == mp_token_operation) { - if (mp_type(p) == mp_string_type) { + } else if (p->name_type == mp_token_operation) { + if (p->type == mp_string_type) { r = mp_get_value_str(p)->str; } } @@ -20420,7 +20418,7 @@ void mp_scan_numeric_value (MP mp, int primary, double *d) } # define mp_set_double_value(mp,target,what) \ -if (mp_type(what) == mp_known_type) { \ +if (what->type == mp_known_type) { \ *target = number_to_double(mp_get_value_number(what)); \ } @@ -20579,13 +20577,13 @@ void mp_push_pair_value (MP mp, double x, double y) v = mp_get_value_node(p); new_number_from_double(mp, px, x); new_number_from_double(mp, py, y); - mp_type(mp_x_part(v)) = mp_known_type; - mp_type(mp_y_part(v)) = mp_known_type; + mp_x_part(v)->type = mp_known_type; + mp_y_part(v)->type = mp_known_type; mp_set_value_number(mp_x_part(v), px); mp_set_value_number(mp_y_part(v), py); free_number(px); free_number(py); - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp->cur_exp.type = mp_pair_type; mp_set_cur_exp_node(mp, p); mp_back_expr(mp); @@ -20601,16 +20599,16 @@ void mp_push_color_value (MP mp, double r, double g, double b) new_number_from_double(mp, pr, r); new_number_from_double(mp, pg, g); new_number_from_double(mp, pb, b); - mp_type(mp_red_part (v)) = mp_known_type; - mp_type(mp_green_part(v)) = mp_known_type; - mp_type(mp_blue_part (v)) = mp_known_type; + mp_red_part (v)->type = mp_known_type; + mp_green_part(v)->type = mp_known_type; + mp_blue_part (v)->type = mp_known_type; mp_set_value_number(mp_red_part (v), pr); mp_set_value_number(mp_green_part(v), pg); mp_set_value_number(mp_blue_part (v), pb); free_number(pr); free_number(pg); free_number(pb); - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp->cur_exp.type = mp_color_type; mp_set_cur_exp_node(mp, p); mp_back_expr(mp); @@ -20627,10 +20625,10 @@ void mp_push_cmykcolor_value (MP mp, double c, double m, double y, double k) new_number_from_double(mp, pm, m); new_number_from_double(mp, py, y); new_number_from_double(mp, pk, k); - mp_type(mp_cyan_part (v)) = mp_known_type; - mp_type(mp_magenta_part(v)) = mp_known_type; - mp_type(mp_yellow_part (v)) = mp_known_type; - mp_type(mp_black_part (v)) = mp_known_type; + mp_cyan_part (v)->type = mp_known_type; + mp_magenta_part(v)->type = mp_known_type; + mp_yellow_part (v)->type = mp_known_type; + mp_black_part (v)->type = mp_known_type; mp_set_value_number(mp_cyan_part (v), pc); mp_set_value_number(mp_magenta_part(v), pm); mp_set_value_number(mp_yellow_part (v), py); @@ -20639,7 +20637,7 @@ void mp_push_cmykcolor_value (MP mp, double c, double m, double y, double k) free_number(pm); free_number(py); free_number(pk); - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp->cur_exp.type = mp_cmykcolor_type; mp_set_cur_exp_node(mp, p); mp_back_expr(mp); @@ -20658,12 +20656,12 @@ void mp_push_transform_value (MP mp, double x, double y, double xx, double xy, d new_number_from_double(mp, pxy, xy); new_number_from_double(mp, pyx, yx); new_number_from_double(mp, pyy, yy); - mp_type(mp_x_part (v)) = mp_known_type; - mp_type(mp_y_part (v)) = mp_known_type; - mp_type(mp_xx_part(v)) = mp_known_type; - mp_type(mp_xy_part(v)) = mp_known_type; - mp_type(mp_yx_part(v)) = mp_known_type; - mp_type(mp_yy_part(v)) = mp_known_type; + mp_x_part (v)->type = mp_known_type; + mp_y_part (v)->type = mp_known_type; + mp_xx_part(v)->type = mp_known_type; + mp_xy_part(v)->type = mp_known_type; + mp_yx_part(v)->type = mp_known_type; + mp_yy_part(v)->type = mp_known_type; mp_set_value_number(mp_x_part (v), px); mp_set_value_number(mp_y_part (v), py); mp_set_value_number(mp_xx_part(v), pxx); @@ -20676,7 +20674,7 @@ void mp_push_transform_value (MP mp, double x, double y, double xx, double xy, d free_number(pxy); free_number(pyx); free_number(pyy); - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp->cur_exp.type = mp_transform_type; mp_set_cur_exp_node(mp, p); mp_back_expr(mp); @@ -20723,7 +20721,7 @@ void mp_scan_primary (MP mp) mp_node q = mp_new_value_node(mp); mp_node p1 = mp_stash_cur_exp(mp); mp_node r; - mp_name_type(q) = mp_capsule_operation; + q->name_type = mp_capsule_operation; mp_get_x_next(mp); mp_scan_expression(mp); if (mp->cur_exp.type < mp_known_type) { @@ -20806,7 +20804,7 @@ void mp_scan_primary (MP mp) } } mp_check_delimiter(mp, l_delim, r_delim); - mp->cur_exp.type = mp_type(q); + mp->cur_exp.type = q->type; mp_set_cur_exp_node(mp, q); } else { mp_check_delimiter(mp, l_delim, r_delim); @@ -20977,7 +20975,7 @@ void mp_scan_primary (MP mp) if (cur_cmd == mp_assignment_command) { mp_set_cur_exp_node(mp, mp_new_symbolic_node(mp)); mp_set_sym_info(cur_exp_node, qq); - mp_name_type(cur_exp_node) = mp_internal_operation; + cur_exp_node->name_type = mp_internal_operation; mp->cur_exp.type = mp_token_list_type; goto DONE; } @@ -21006,10 +21004,10 @@ void mp_scan_primary (MP mp) mp_node post_head = NULL; while (1) { t = mp_cur_tok(mp); - mp_link(tail) = t; + tail->link = t; if (tt != mp_undefined_type) { mp_sym qq; - p = mp_link(pre_head); + p = pre_head->link; qq = mp_get_sym_sym(p); tt = mp_undefined_type; @@ -21019,18 +21017,18 @@ void mp_scan_primary (MP mp) goto DONE2; } while (1) { - p = mp_link(p); + p = p->link; if (p == NULL) { - tt = mp_type(q); + tt = q->type; goto DONE2; } - if (mp_type(q) != mp_structured_type) { + if (q->type != mp_structured_type) { goto DONE2; } - q = mp_link(mp_get_attribute_head(q)); - if (mp_type(p) == mp_symbol_node_type) { + q = mp_get_attribute_head(q)->link; + if (p->type == mp_symbol_node_type) { do { - q = mp_link(q); + q = q->link; } while (! (mp_get_hashloc(q) >= mp_get_sym_sym(p))); if (mp_get_hashloc(q) > mp_get_sym_sym(p)) { goto DONE2; @@ -21040,18 +21038,18 @@ void mp_scan_primary (MP mp) } DONE2: if (tt >= mp_unsuffixed_macro_type) { - mp_link(tail) = NULL; + tail->link = NULL; if (tt > mp_unsuffixed_macro_type) { post_head = mp_new_symbolic_node(mp); tail = post_head; - mp_link(tail) = t; + tail->link = t; tt = mp_undefined_type; macro_ref = mp_get_value_node(q); mp_add_mac_ref(macro_ref); } else { p = mp_new_symbolic_node(mp); - mp_set_sym_sym(pre_head, mp_link(pre_head)); - mp_link(pre_head) = p; + mp_set_sym_sym(pre_head, pre_head->link); + pre_head->link = p; mp_set_sym_sym(p, t); mp_macro_call(mp, mp_get_value_node(q), pre_head, NULL); mp_get_x_next(mp); @@ -21088,19 +21086,19 @@ void mp_scan_primary (MP mp) if (post_head != NULL) { mp_back_input(mp); p = mp_new_symbolic_node(mp); - q = mp_link(post_head); - mp_set_sym_sym(pre_head, mp_link(pre_head)); - mp_link(pre_head) = post_head; + q = post_head->link; + mp_set_sym_sym(pre_head, pre_head->link); + pre_head->link = post_head; mp_set_sym_sym(post_head, q); - mp_link(post_head) = p; - mp_set_sym_sym(p, mp_link(q)); - mp_link(q) = NULL; + post_head->link = p; + mp_set_sym_sym(p, q->link); + q->link = NULL; mp_macro_call(mp, macro_ref, pre_head, NULL); mp_decr_mac_ref(macro_ref); mp_get_x_next(mp); goto RESTART; } - q = mp_link(pre_head); + q = pre_head->link; mp_free_symbolic_node(mp, pre_head); if (cur_cmd == my_var_flag) { mp->cur_exp.type = mp_token_list_type; @@ -21205,15 +21203,15 @@ static void mp_scan_suffix (MP mp) } else if ((cur_cmd == mp_tag_command) || (cur_cmd == mp_internal_command)) { p = mp_new_symbolic_node(mp); mp_set_sym_sym(p, cur_sym); - mp_name_type(p) = cur_sym_mod; + p->name_type = cur_sym_mod; } else { break; } - mp_link(t) = p; + t->link = p; t = p; mp_get_x_next(mp); } - mp_set_cur_exp_node(mp, mp_link(h)); + mp_set_cur_exp_node(mp, h->link); mp_free_symbolic_node(mp, h); mp->cur_exp.type = mp_token_list_type; } @@ -21308,7 +21306,7 @@ static void mp_scan_expression (MP mp) mac_name = cur_sym; mp_add_mac_ref(cc); } - if ((d < mp_ampersand_command) || ((d == mp_ampersand_command) && ((mp_type(p) == mp_pair_type) || (mp_type(p) == mp_path_type)))) { + if ((d < mp_ampersand_command) || ((d == mp_ampersand_command) && ((p->type == mp_pair_type) || (p->type == mp_path_type)))) { mp_unstash_cur_exp(mp, p); if (! mp_scan_path(mp)) { mp->expand_depth_count--; @@ -21704,8 +21702,8 @@ void mp_final_cleanup (MP mp) } mp_print_str(mp, " was incomplete)"); mp->if_line = mp_if_line_field(mp->cond_ptr); - mp->cur_if = mp_name_type(mp->cond_ptr); - mp->cond_ptr = mp_link(mp->cond_ptr); + mp->cur_if = mp->cond_ptr->name_type; + mp->cond_ptr = mp->cond_ptr->link; } if (mp->history != mp_spotless) { if (((mp->history == mp_warning_issued) || (mp->interaction < mp_error_stop_mode))) { @@ -22098,7 +22096,7 @@ void mp_final_cleanup (MP mp) mp_set_dep_list(mp->dep_head, NULL); mp->cur_mod_ = mp_new_symbolic_node(mp); mp->bad_vardef = mp_new_value_node(mp); - mp_name_type(mp->bad_vardef) = mp_root_operation; + mp->bad_vardef->name_type = mp_root_operation; mp_set_value_sym(mp->bad_vardef, mp->frozen_bad_vardef); mp->frozen_repeat_loop = @@ -22107,7 +22105,7 @@ void mp_final_cleanup (MP mp) new_number(mp->max_c[i]); } mp->temp_val = mp_new_value_node(mp); - mp_name_type(mp->temp_val) = mp_capsule_operation; + mp->temp_val->name_type = mp_capsule_operation; new_number(mp->txx); new_number(mp->txy); new_number(mp->tyx); diff --git a/source/luametatex/source/mp/mpc/mpmath.c b/source/luametatex/source/mp/mpc/mpmath.c index 42a596dac..0a848b23e 100644 --- a/source/luametatex/source/mp/mpc/mpmath.c +++ b/source/luametatex/source/mp/mpc/mpmath.c @@ -585,9 +585,9 @@ int mp_number_nonequalabs(mp_number *A, mp_number *B) static char *mp_string_scaled (MP mp, int s) { - (void) mp; static char scaled_string[32]; int i = 0; + (void) mp; if (s < 0) { scaled_string[i++] = '-'; s = -s; diff --git a/source/luametatex/source/mp/mpc/mpmathdecimal.c b/source/luametatex/source/mp/mpc/mpmathdecimal.c index 5ffa1e04f..268217f3e 100644 --- a/source/luametatex/source/mp/mpc/mpmathdecimal.c +++ b/source/luametatex/source/mp/mpc/mpmathdecimal.c @@ -766,18 +766,18 @@ void mp_number_scaled_to_angle(mp_number *A) int mp_number_to_scaled(mp_number *A) { - int32_t result; + int result; decNumber corrected; decNumberFromInt32(&corrected, 65536); decNumberMultiply(&corrected, &corrected, A->data.num, &mp_decimal_data.set); decNumberReduce(&corrected, &corrected, &mp_decimal_data.set); - result = (int) floor(decNumberToDouble(&corrected) + 0.5); + result = lround(decNumberToDouble(&corrected)); return result; } int mp_number_to_int(mp_number *A) { - int32_t result; + int result; mp_decimal_data.set.status = 0; result = decNumberToInt32(A->data.num, &mp_decimal_data.set); if (mp_decimal_data.set.status == DEC_Invalid_operation) { @@ -790,7 +790,7 @@ int mp_number_to_int(mp_number *A) int mp_number_to_boolean(mp_number *A) { - uint32_t result; + unsigned int result; mp_decimal_data.set.status = 0; result = decNumberToUInt32(A->data.num, &mp_decimal_data.set); if (mp_decimal_data.set.status == DEC_Invalid_operation) { @@ -1413,7 +1413,7 @@ typedef struct mp_decimal_random_info { long *ptr; } mp_decimal_random_info; -mp_decimal_random_info mp_decimal_random_data = { +static mp_decimal_random_info mp_decimal_random_data = { .dummy = -1, .started = -1, .ptr = &mp_decimal_random_data.dummy diff --git a/source/luametatex/source/mp/mpc/mpmathdouble.c b/source/luametatex/source/mp/mpc/mpmathdouble.c index 99be94727..8349a3b66 100644 --- a/source/luametatex/source/mp/mpc/mpmathdouble.c +++ b/source/luametatex/source/mp/mpc/mpmathdouble.c @@ -960,7 +960,7 @@ typedef struct mp_double_random_info { long *ptr; } mp_double_random_info; -mp_double_random_info mp_double_random_data = { +static mp_double_random_info mp_double_random_data = { .dummy = -1, .started = -1, .ptr = &mp_double_random_data.dummy diff --git a/source/luametatex/source/mp/mpc/mpstrings.c b/source/luametatex/source/mp/mpc/mpstrings.c index 593985a68..ceeccb127 100644 --- a/source/luametatex/source/mp/mpc/mpstrings.c +++ b/source/luametatex/source/mp/mpc/mpstrings.c @@ -277,7 +277,7 @@ mp_string mp_chop_string(MP mp, mp_string s, int a, int b) a = l; } } - mp_str_room(mp, (size_t) (b - a)); + mp_str_room(mp, (b - a)); if (reversed) { for (int k = b - 1; k >= a; k--) { mp_append_char(mp, *(s->str + k)); diff --git a/source/luametatex/source/mp/mpw/mp.w b/source/luametatex/source/mp/mpw/mp.w index a7a1a9b7d..fe47d3d82 100644 --- a/source/luametatex/source/mp/mpw/mp.w +++ b/source/luametatex/source/mp/mpw/mp.w @@ -2109,7 +2109,7 @@ static void mp_free_node (MP mp, mp_node p, size_t siz) There was a quite large |switch| here first, but the |mp_dash_node| case was the only one that did anything ... */ - if (mp_type(p) == mp_dash_node_type) { + if (p->type == mp_dash_node_type) { free_number(((mp_dash_node) p)->start_x); free_number(((mp_dash_node) p)->stop_x); free_number(((mp_dash_node) p)->dash_y); @@ -3866,8 +3866,8 @@ static void mp_flush_token_list (MP mp, mp_node p) { while (p != NULL) { mp_node q = p; /* the node being recycled */ - p = mp_link(p); - switch (mp_type(q)) { + p = p->link; + switch (q->type) { case mp_symbol_node_type: mp_free_symbolic_node(mp, q); continue; @@ -3933,9 +3933,9 @@ void mp_show_token_list (MP mp, mp_node p, mp_node q) (void) q; while (p != NULL) { int c = mp_letter_class; - if (mp_type(p) != mp_symbol_node_type) { - if (mp_name_type(p) == mp_token_operation) { - if (mp_type(p) == mp_known_type) { + if (p->type != mp_symbol_node_type) { + if (p->name_type == mp_token_operation) { + if (p->type == mp_known_type) { if (cclass == mp_digit_class) { mp_print_chr(mp, ' '); } @@ -3951,7 +3951,7 @@ void mp_show_token_list (MP mp, mp_node p, mp_node q) print_number(mp_get_value_number(p)); c = mp_digit_class; } - } else if (mp_type(p) == mp_string_type) { + } else if (p->type == mp_string_type) { mp_print_chr(mp, '"'); mp_print_mp_str(mp, mp_get_value_str(p)); mp_print_chr(mp, '"'); @@ -3959,17 +3959,17 @@ void mp_show_token_list (MP mp, mp_node p, mp_node q) } else { mp_print_str(mp, " BAD"); } - } else if ((mp_name_type(p) != mp_capsule_operation) || (mp_type(p) < mp_vacuous_type) || (mp_type(p) > mp_independent_type)) { + } else if ((p->name_type != mp_capsule_operation) || (p->type < mp_vacuous_type) || (p->type > mp_independent_type)) { mp_print_str(mp, " BAD"); } else { mp_print_capsule(mp, p); c = mp_right_parenthesis_class; } - } else if (mp_name_type(p) == mp_expr_operation || mp_name_type(p) == mp_suffix_operation || mp_name_type(p) == mp_text_operation) { + } else if (p->name_type == mp_expr_operation || p->name_type == mp_suffix_operation || p->name_type == mp_text_operation) { int r = mp_get_sym_info(p); - if (mp_name_type(p) == mp_expr_operation) { + if (p->name_type == mp_expr_operation) { mp_print_str(mp, "(EXPR"); - } else if (mp_name_type(p) == mp_suffix_operation) { + } else if (p->name_type == mp_suffix_operation) { mp_print_str(mp, "(SUFFIX"); } else { mp_print_str(mp, "(TEXT"); @@ -4011,7 +4011,7 @@ void mp_show_token_list (MP mp, mp_node p, mp_node q) } } cclass = c; - p = mp_link(p); + p = p->link; } return; } @@ -4020,9 +4020,9 @@ void mp_show_token_list_space (MP mp, mp_node p, mp_node q) { (void) q; while (p != NULL) { - if (mp_type(p) != mp_symbol_node_type) { - if (mp_name_type(p) == mp_token_operation) { - if (mp_type(p) == mp_known_type) { + if (p->type != mp_symbol_node_type) { + if (p->name_type == mp_token_operation) { + if (p->type == mp_known_type) { if (number_negative(mp_get_value_number(p))) { mp_print_str(mp, "[ "); print_number(mp_get_value_number(p)); @@ -4030,23 +4030,23 @@ void mp_show_token_list_space (MP mp, mp_node p, mp_node q) } else { print_number(mp_get_value_number(p)); } - } else if (mp_type(p) == mp_string_type) { + } else if (p->type == mp_string_type) { mp_print_chr(mp, '"'); mp_print_mp_str(mp, mp_get_value_str(p)); mp_print_chr(mp, '"'); } else { mp_print_str(mp, "BAD"); } - } else if ((mp_name_type(p) != mp_capsule_operation) || (mp_type(p) < mp_vacuous_type) || (mp_type(p) > mp_independent_type)) { + } else if ((p->name_type != mp_capsule_operation) || (p->type < mp_vacuous_type) || (p->type > mp_independent_type)) { mp_print_str(mp, "BAD"); } else { mp_print_capsule(mp, p); } - } else if (mp_name_type(p) == mp_expr_operation || mp_name_type(p) == mp_suffix_operation || mp_name_type(p) == mp_text_operation) { + } else if (p->name_type == mp_expr_operation || p->name_type == mp_suffix_operation || p->name_type == mp_text_operation) { int r = mp_get_sym_info(p); - if (mp_name_type(p) == mp_expr_operation) { + if (p->name_type == mp_expr_operation) { mp_print_str(mp, "(EXPR "); - } else if (mp_name_type(p) == mp_suffix_operation) { + } else if (p->name_type == mp_suffix_operation) { mp_print_str(mp, "(SUFFIX "); } else { mp_print_str(mp, "(TEXT "); @@ -4066,7 +4066,7 @@ void mp_show_token_list_space (MP mp, mp_node p, mp_node q) } } } - p = mp_link(p); + p = p->link; if (p) { mp_print_chr(mp, ' '); } @@ -4136,12 +4136,12 @@ count. @c static void mp_show_macro (MP mp, mp_node p, mp_node q) { - p = mp_link(p); /* bypass the reference count */ - while (mp_name_type(p) != mp_macro_operation) { - mp_node r = mp_link(p); - mp_link(p) = NULL; + p = p->link; /* bypass the reference count */ + while (p->name_type != mp_macro_operation) { + mp_node r = p->link; + p->link = NULL; mp_show_token_list(mp, p, NULL); - mp_link(p) = r; + p->link = r; p = r; } switch (mp_get_sym_info(p)) { @@ -4169,7 +4169,7 @@ static void mp_show_macro (MP mp, mp_node p, mp_node q) mp_print_str(mp, "<text> -> "); break; } - mp_show_token_list(mp, mp_link(p), q); + mp_show_token_list(mp, p->link, q); } @* Data structures for variables. @@ -4295,7 +4295,7 @@ static mp_node mp_new_value_node (MP mp) new_number(p->subscript); p->hasnumber = 2; } - mp_type(p) = mp_value_node_type; + p->type = mp_value_node_type; return (mp_node) p; } @@ -4396,7 +4396,7 @@ subscript attributes. static mp_value_node mp_get_attribute_node (MP mp) { mp_value_node p = (mp_value_node) mp_new_value_node(mp); - mp_type(p) = mp_attribute_node_type; + p->type = mp_attribute_node_type; return p; } @@ -4421,7 +4421,7 @@ mp_free_value_node(mp, mp->end_attr); static mp_value_node mp_get_subscr_node (MP mp) { mp_value_node p = (mp_value_node) mp_new_value_node(mp); - mp_type(p) = mp_subscript_node_type; + p->type = mp_subscript_node_type; return p; } @@ -4460,7 +4460,7 @@ static mp_node mp_get_pair_node (MP mp) } else { p = mp_allocate_node(mp, sizeof(mp_pair_node_data)); } - mp_type(p) = mp_pair_node_type; + p->type = mp_pair_node_type; return (mp_node) p; } @@ -4487,16 +4487,16 @@ such nodes are initially of type |mp_independent|. static void mp_init_pair_node (MP mp, mp_node p) { mp_node q; /* the new node */ - mp_type(p) = mp_pair_type; + p->type = mp_pair_type; q = mp_get_pair_node(mp); mp_y_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_y_part(q)); /* sets |type(q)| and |value(q)| */ - mp_name_type(mp_y_part(q)) = mp_y_part_operation; - mp_link(mp_y_part(q)) = p; + mp_y_part(q)->name_type = mp_y_part_operation; + mp_y_part(q)->link = p; mp_x_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_x_part(q)); /* sets |type(q)| and |value(q)| */ - mp_name_type(mp_x_part(q)) = mp_x_part_operation; - mp_link(mp_x_part(q)) = p; + mp_x_part(q)->name_type = mp_x_part_operation; + mp_x_part(q)->link = p; mp_set_value_node(p, q); } @@ -4534,7 +4534,7 @@ typedef struct mp_transform_node_data *mp_transform_node; static mp_node mp_get_transform_node (MP mp) { mp_transform_node p = (mp_transform_node) mp_allocate_node(mp, sizeof(mp_transform_node_data)); - mp_type(p) = mp_transform_node_type; + p->type = mp_transform_node_type; return (mp_node) p; } @@ -4542,32 +4542,32 @@ static mp_node mp_get_transform_node (MP mp) static void mp_init_transform_node (MP mp, mp_node p) { mp_node q; /* the new node */ - mp_type(p) = mp_transform_type; + p->type = mp_transform_type; q = mp_get_transform_node(mp); /* big node */ mp_yy_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_yy_part(q)); /* sets |type(q)| and |value(q)| */ - mp_name_type(mp_yy_part(q)) = mp_yy_part_operation; - mp_link(mp_yy_part(q)) = p; + mp_yy_part(q)->name_type = mp_yy_part_operation; + mp_yy_part(q)->link = p; mp_yx_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_yx_part(q)); /* sets |type(q)| and |value(q)| */ - mp_name_type(mp_yx_part(q)) = mp_yx_part_operation; - mp_link(mp_yx_part(q)) = p; + mp_yx_part(q)->name_type = mp_yx_part_operation; + mp_yx_part(q)->link = p; mp_xy_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_xy_part(q)); /* sets |type(q)| and |value(q)| */ - mp_name_type(mp_xy_part(q)) = mp_xy_part_operation; - mp_link(mp_xy_part(q)) = p; + mp_xy_part(q)->name_type = mp_xy_part_operation; + mp_xy_part(q)->link = p; mp_xx_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_xx_part(q)); /* sets |type(q)| and |value(q)| */ - mp_name_type(mp_xx_part(q)) = mp_xx_part_operation; - mp_link(mp_xx_part(q)) = p; + mp_xx_part(q)->name_type = mp_xx_part_operation; + mp_xx_part(q)->link = p; mp_ty_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_ty_part(q)); /* sets |type(q)| and |value(q)| */ - mp_name_type(mp_ty_part(q)) = mp_y_part_operation; - mp_link(mp_ty_part(q)) = p; + mp_ty_part(q)->name_type = mp_y_part_operation; + mp_ty_part(q)->link = p; mp_tx_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_tx_part(q)); /* sets |type(q)| and |value(q)| */ - mp_name_type(mp_tx_part(q)) = mp_x_part_operation; - mp_link(mp_tx_part(q)) = p; + mp_tx_part(q)->name_type = mp_x_part_operation; + mp_tx_part(q)->link = p; mp_set_value_node(p, q); } @@ -4615,49 +4615,48 @@ typedef struct mp_color_node_data *mp_color_node; static void mp_init_color_node (MP mp, mp_node p, int type) { mp_node q = (mp_node) mp_allocate_node(mp, sizeof(mp_color_node_data)); - q->link = NULL; - mp_type(p) = type; + p->type = type; switch (type) { case mp_color_type: - mp_type(q) = mp_color_node_type; + q->type = mp_color_node_type; /* */ mp_red_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_red_part(q)); - mp_name_type(mp_red_part(q)) = mp_red_part_operation; - mp_link(mp_red_part(q)) = p; + mp_red_part(q)->name_type = mp_red_part_operation; + mp_red_part(q)->link = p; /* */ mp_green_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_green_part(q)); - mp_name_type(mp_green_part(q)) = mp_green_part_operation; - mp_link(mp_green_part(q)) = p; + mp_green_part(q)->name_type = mp_green_part_operation; + mp_green_part(q)->link = p; /* */ mp_blue_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_blue_part(q)); - mp_name_type(mp_blue_part(q)) = mp_blue_part_operation; - mp_link(mp_blue_part(q)) = p; + mp_blue_part(q)->name_type = mp_blue_part_operation; + mp_blue_part(q)->link = p; break; case mp_cmykcolor_type: - mp_type(q) = mp_cmykcolor_node_type; + q->type = mp_cmykcolor_node_type; /* */ mp_cyan_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_cyan_part(q)); - mp_name_type(mp_cyan_part(q)) = mp_cyan_part_operation; - mp_link(mp_cyan_part(q)) = p; + mp_cyan_part(q)->name_type = mp_cyan_part_operation; + mp_cyan_part(q)->link = p; /* */ mp_magenta_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_magenta_part(q)); - mp_name_type(mp_magenta_part(q)) = mp_magenta_part_operation; - mp_link(mp_magenta_part(q)) = p; + mp_magenta_part(q)->name_type = mp_magenta_part_operation; + mp_magenta_part(q)->link = p; /* */ mp_yellow_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_yellow_part(q)); - mp_name_type(mp_yellow_part(q)) = mp_yellow_part_operation; - mp_link(mp_yellow_part(q)) = p; + mp_yellow_part(q)->name_type = mp_yellow_part_operation; + mp_yellow_part(q)->link = p; /* */ mp_black_part(q) = mp_new_value_node(mp); mp_new_indep(mp, mp_black_part(q)); - mp_name_type(mp_black_part(q)) = mp_black_part_operation; - mp_link(mp_black_part(q)) = p; + mp_black_part(q)->name_type = mp_black_part_operation; + mp_black_part(q)->link = p; break; } mp_set_value_node(p, q); @@ -4675,21 +4674,21 @@ static mp_node mp_id_transform (MP mp) { mp_node q; mp_node p = mp_new_value_node(mp); - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp_set_value_number(p, zero_t); /* todo: this was |null| */ mp_init_transform_node(mp, p); q = mp_get_value_node(p); - mp_type(mp_tx_part(q)) = mp_known_type; + mp_tx_part(q)->type = mp_known_type; mp_set_value_number(mp_tx_part(q), zero_t); - mp_type(mp_ty_part(q)) = mp_known_type; + mp_ty_part(q)->type = mp_known_type; mp_set_value_number(mp_ty_part(q), zero_t); - mp_type(mp_xy_part(q)) = mp_known_type; + mp_xy_part(q)->type = mp_known_type; mp_set_value_number(mp_xy_part(q), zero_t); - mp_type(mp_yx_part(q)) = mp_known_type; + mp_yx_part(q)->type = mp_known_type; mp_set_value_number(mp_yx_part(q), zero_t); - mp_type(mp_xx_part(q)) = mp_known_type; + mp_xx_part(q)->type = mp_known_type; mp_set_value_number(mp_xx_part(q), unity_t); - mp_type(mp_yy_part(q)) = mp_known_type; + mp_yy_part(q)->type = mp_known_type; mp_set_value_number(mp_yy_part(q), unity_t); return p; } @@ -4702,8 +4701,8 @@ establishes the root node on such grand occasions. static void mp_new_root (MP mp, mp_sym x) { mp_node p = mp_new_value_node(mp); - mp_type(p) = mp_undefined_type; - mp_name_type(p) = mp_root_operation; + p->type = mp_undefined_type; + p->name_type = mp_root_operation; mp_set_value_sym(p, x); set_equiv_node(x, p); } @@ -4720,8 +4719,8 @@ void mp_print_variable_name (MP mp, mp_node p) { mp_node q = NULL; /* a token list that will name the variable's suffix */ mp_node r = NULL; /* temporary for token list creation */ - while (mp_name_type(p) >= mp_x_part_operation) { - switch (mp_name_type(p)) { + while (p->name_type >= mp_x_part_operation) { + switch (p->name_type) { case mp_x_part_operation : mp_print_str(mp, "xpart "); break; case mp_y_part_operation : mp_print_str(mp, "ypart "); break; case mp_xx_part_operation : mp_print_str(mp, "xxpart "); break; @@ -4739,22 +4738,22 @@ void mp_print_variable_name (MP mp, mp_node p) case mp_capsule_operation : mp_print_fmt(mp, "%%CAPSULE%p", p); return; default : break; } - p = mp_link(p); + p = p->link; } - while (mp_name_type(p) > mp_saved_root_operation) { + while (p->name_type > mp_saved_root_operation) { /* Ascend one level, pushing a token onto list |q| and replacing |p| by its parent */ - if (mp_name_type(p) == mp_subscript_operation) { + if (p->name_type == mp_subscript_operation) { r = mp_new_num_tok(mp, &(mp_subscript(p))); do { - p = mp_link(p); - } while (mp_name_type(p) != mp_attribute_operation); - } else if (mp_name_type(p) == mp_structured_root_operation) { - p = mp_link(p); + p = p->link; + } while (p->name_type != mp_attribute_operation); + } else if (p->name_type == mp_structured_root_operation) { + p = p->link; goto FOUND; - } else if (mp_name_type(p) != mp_attribute_operation) { + } else if (p->name_type != mp_attribute_operation) { mp_confusion(mp, "variable"); } else { r = mp_new_symbolic_node(mp); @@ -4774,8 +4773,8 @@ void mp_print_variable_name (MP mp, mp_node p) */ r = mp_new_symbolic_node(mp); mp_set_sym_sym(r, mp_get_value_sym(p)); - mp_link(r) = q; - if (mp_name_type(p) == mp_saved_root_operation) { + r->link = q; + if (p->name_type == mp_saved_root_operation) { mp_print_str(mp, "(SAVED)"); } mp_show_token_list(mp, r, NULL); @@ -4791,25 +4790,25 @@ static int mp_interesting (MP mp, mp_node p) if (number_positive(internal_value(mp_tracing_capsules_internal))) { return 1; } else { - mp_name_type_type t = mp_name_type(p); + mp_name_type_type t = p->name_type; if (t >= mp_x_part_operation && t != mp_capsule_operation) { - mp_node tt = mp_get_value_node(mp_link(p)); + mp_node tt = mp_get_value_node(p->link); switch (t) { - case mp_x_part_operation: t = mp_name_type(mp_x_part (tt)); break; - case mp_y_part_operation: t = mp_name_type(mp_y_part (tt)); break; - case mp_xx_part_operation: t = mp_name_type(mp_xx_part (tt)); break; - case mp_xy_part_operation: t = mp_name_type(mp_xy_part (tt)); break; - case mp_yx_part_operation: t = mp_name_type(mp_yx_part (tt)); break; - case mp_yy_part_operation: t = mp_name_type(mp_yy_part (tt)); break; - case mp_red_part_operation: t = mp_name_type(mp_red_part (tt)); break; - case mp_green_part_operation: t = mp_name_type(mp_green_part (tt)); break; - case mp_blue_part_operation: t = mp_name_type(mp_blue_part (tt)); break; - case mp_cyan_part_operation: t = mp_name_type(mp_cyan_part (tt)); break; - case mp_magenta_part_operation: t = mp_name_type(mp_magenta_part(tt)); break; - case mp_yellow_part_operation: t = mp_name_type(mp_yellow_part (tt)); break; - case mp_black_part_operation: t = mp_name_type(mp_black_part (tt)); break; - case mp_grey_part_operation: t = mp_name_type(mp_grey_part (tt)); break; - default: break; + case mp_x_part_operation: t = mp_x_part (tt)->name_type; break; + case mp_y_part_operation: t = mp_y_part (tt)->name_type; break; + case mp_xx_part_operation: t = mp_xx_part (tt)->name_type; break; + case mp_xy_part_operation: t = mp_xy_part (tt)->name_type; break; + case mp_yx_part_operation: t = mp_yx_part (tt)->name_type; break; + case mp_yy_part_operation: t = mp_yy_part (tt)->name_type; break; + case mp_red_part_operation: t = mp_red_part (tt)->name_type; break; + case mp_green_part_operation: t = mp_green_part (tt)->name_type; break; + case mp_blue_part_operation: t = mp_blue_part (tt)->name_type; break; + case mp_cyan_part_operation: t = mp_cyan_part (tt)->name_type; break; + case mp_magenta_part_operation: t = mp_magenta_part(tt)->name_type; break; + case mp_yellow_part_operation: t = mp_yellow_part (tt)->name_type; break; + case mp_black_part_operation: t = mp_black_part (tt)->name_type; break; + case mp_grey_part_operation: t = mp_grey_part (tt)->name_type; break; + default: break; } } return (t != mp_capsule_operation); @@ -4828,7 +4827,7 @@ fields changed in any way. static mp_node mp_new_structure (MP mp, mp_node p) { mp_node r = NULL; - switch (mp_name_type(p)) { + switch (p->name_type) { case mp_root_operation: { mp_sym q = mp_get_value_sym(p); @@ -4842,14 +4841,14 @@ static mp_node mp_new_structure (MP mp, mp_node p) mp_node q_new; mp_node q = p; do { - q = mp_link(q); - } while (mp_name_type(q) != mp_attribute_operation); + q = q->link; + } while (q->name_type != mp_attribute_operation); q = mp_get_parent((mp_value_node) q); r = mp->temp_head; mp_set_link(r, mp_get_subscr_head(q)); do { q_new = r; - r = mp_link(r); + r = r->link; } while (r != p); r = (mp_node) mp_get_subscr_node(mp); if (q_new == mp->temp_head) { @@ -4872,7 +4871,7 @@ static mp_node mp_new_structure (MP mp, mp_node p) r = mp_get_attribute_head(q); do { q = r; - r = mp_link(r); + r = r->link; } while (r != p); rr = mp_get_attribute_node(mp); r = (mp_node) rr; @@ -4882,8 +4881,8 @@ static mp_node mp_new_structure (MP mp, mp_node p) if (mp_get_hashloc(p) == mp_collective_subscript) { q = mp->temp_head; mp_set_link(q, mp_get_subscr_head(mp_get_parent((mp_value_node) p))); - while (mp_link(q) != p) { - q = mp_link(q); + while (q->link != p) { + q = q->link; } if (q == mp->temp_head) { mp_set_subscr_head(mp_get_parent((mp_value_node) p), (mp_node) rr); @@ -4899,18 +4898,18 @@ static mp_node mp_new_structure (MP mp, mp_node p) } if (r) { mp_value_node q; - mp_set_link(r, mp_link(p)); + mp_set_link(r, p->link); mp_set_value_sym(r, mp_get_value_sym(p)); - mp_type(r) = mp_structured_type; - mp_name_type(r) = mp_name_type(p); + r->type = mp_structured_type; + r->name_type = p->name_type; mp_set_attribute_head(r, p); - mp_name_type(p) = mp_structured_root_operation; + p->name_type = mp_structured_root_operation; q = mp_get_attribute_node(mp); mp_set_link(p, q); mp_set_subscr_head(r, (mp_node) q); mp_set_parent(q, r); - mp_type(q) = mp_undefined_type; - mp_name_type(q) = mp_attribute_operation; + q->type = mp_undefined_type; + q->name_type = mp_attribute_operation; mp_set_link(q, mp->end_attr); mp_set_hashloc(q, mp_collective_subscript); } @@ -4940,7 +4939,7 @@ static mp_node mp_find_variable (MP mp, mp_node t) } else { mp_node p, q, r, s; /* nodes in the \quote {value} line */ mp_node pp, qq, rr, ss; /* nodes in the \quote {collective} line */ - t = mp_link(t); + t = t->link; if (equiv_node(p_sym) == NULL) { mp_new_root (mp, p_sym); } @@ -4953,8 +4952,8 @@ static mp_node mp_find_variable (MP mp, mp_node t) occurs; |pp|~stays in the collective line while |p|~goes through actual subscript values. */ - if (mp_type(pp) != mp_structured_type) { - if (mp_type(pp) > mp_structured_type) { + if (pp->type != mp_structured_type) { + if (pp->type > mp_structured_type) { return NULL; } else { ss = mp_new_structure(mp, pp); @@ -4965,12 +4964,12 @@ static mp_node mp_find_variable (MP mp, mp_node t) } } /* now |type(pp)=mp_structured| */ - if (mp_type(p) != mp_structured_type) { + if (p->type != mp_structured_type) { /* it cannot be |>mp_structured| */ p = mp_new_structure(mp, p); /* now |type(p)=mp_structured| */ } - if (mp_type(t) != mp_symbol_node_type) { + if (t->type != mp_symbol_node_type) { /* Descend one level for the subscript |value (t)| We want this part of the program to be reasonably fast, in case there are lots of @@ -4981,16 +4980,16 @@ static mp_node mp_find_variable (MP mp, mp_node t) */ mp_number nn, save_subscript; /* temporary storage */ new_number_clone(nn, mp_get_value_number(t)); - pp = mp_link(mp_get_attribute_head(pp)); + pp = mp_get_attribute_head(pp)->link; /* now |mp_get_hashloc(pp)=mp_collective_subscript| */ - q = mp_link(mp_get_attribute_head(p)); + q = mp_get_attribute_head(p)->link; new_number_clone(save_subscript, mp_subscript(q)); set_number_to_inf(mp_subscript(q)); s = mp->temp_head; mp_set_link(s, mp_get_subscr_head(p)); do { r = s; - s = mp_link(s); + s = s->link; } while (number_greater(nn, mp_subscript(s))); if (number_equal(nn, mp_subscript(s))) { p = s; @@ -5003,8 +5002,8 @@ static mp_node mp_find_variable (MP mp, mp_node t) } mp_set_link(p1, s); number_clone(mp_subscript(p1), nn); - mp_name_type(p1) = mp_subscript_operation; - mp_type(p1) = mp_undefined_type; + p1->name_type = mp_subscript_operation; + p1->type = mp_undefined_type; p = (mp_node) p1; } number_clone(mp_subscript(q), save_subscript); @@ -5016,15 +5015,15 @@ static mp_node mp_find_variable (MP mp, mp_node t) ss = mp_get_attribute_head(pp); do { rr = ss; - ss = mp_link(ss); + ss = ss->link; } while (nn1 > mp_get_hashloc(ss)); if (nn1 < mp_get_hashloc(ss)) { qq = (mp_node) mp_get_attribute_node(mp); mp_set_link(rr, qq); mp_set_link(qq, ss); mp_set_hashloc(qq, nn1); - mp_name_type(qq) = mp_attribute_operation; - mp_type(qq) = mp_undefined_type; + qq->name_type = mp_attribute_operation; + qq->type = mp_undefined_type; mp_set_parent((mp_value_node) qq, pp); ss = qq; } @@ -5036,7 +5035,7 @@ static mp_node mp_find_variable (MP mp, mp_node t) s = mp_get_attribute_head(p); do { r = s; - s = mp_link(s); + s = s->link; } while (nn1 > mp_get_hashloc(s)); if (nn1 == mp_get_hashloc(s)) { p = s; @@ -5045,31 +5044,31 @@ static mp_node mp_find_variable (MP mp, mp_node t) mp_set_link(r, q); mp_set_link(q, s); mp_set_hashloc(q, nn1); - mp_name_type(q) = mp_attribute_operation; - mp_type(q) = mp_undefined_type; + q->name_type = mp_attribute_operation; + q->type = mp_undefined_type; mp_set_parent((mp_value_node) q, p); p = q; } } } - t = mp_link(t); + t = t->link; } - if (mp_type(pp) >= mp_structured_type) { - if (mp_type(pp) == mp_structured_type) { + if (pp->type >= mp_structured_type) { + if (pp->type == mp_structured_type) { pp = mp_get_attribute_head(pp); } else { return NULL; } } - if (mp_type(p) == mp_structured_type) { + if (p->type == mp_structured_type) { p = mp_get_attribute_head(p); } - if (mp_type(p) == mp_undefined_type) { - if (mp_type(pp) == mp_undefined_type) { - mp_type(pp) = mp_numeric_type; + if (p->type == mp_undefined_type) { + if (pp->type == mp_undefined_type) { + pp->type = mp_numeric_type; mp_set_value_number(pp, zero_t); } - mp_type(p) = mp_type(pp); + p->type = pp->type; mp_set_value_number(p, zero_t); } return p; @@ -5100,35 +5099,35 @@ static void mp_flush_cur_exp (MP mp, mp_value v); static void mp_flush_variable (MP mp, mp_node p, mp_node t, int discard_suffixes) { while (t != NULL) { - if (mp_type(p) != mp_structured_type) { + if (p->type != mp_structured_type) { return; } else { /* attribute to match */ mp_sym n = mp_get_sym_sym(t); - t = mp_link(t); + t = t->link; if (n == mp_collective_subscript) { mp_node q = mp_get_subscr_head(p); mp_node r = NULL; - while (mp_name_type(q) == mp_subscript_operation) { + while (q->name_type == mp_subscript_operation) { mp_flush_variable(mp, q, t, discard_suffixes); if (t != NULL) { r = q; - } else if (mp_type(q) == mp_structured_type) { + } else if (q->type == mp_structured_type) { r = q; } else { if (r == NULL) { - mp_set_subscr_head(p, mp_link(q)); + mp_set_subscr_head(p, q->link); } else { - mp_set_link(r, mp_link(q)); + mp_set_link(r, q->link); } mp_free_value_node(mp, q); } - q = r == NULL ? mp_get_subscr_head(p) : mp_link(r); + q = r == NULL ? mp_get_subscr_head(p) : r->link; } } p = mp_get_attribute_head(p); do { - p = mp_link(p); + p = p->link; } while (mp_get_hashloc(p) < n); if (mp_get_hashloc(p) != n) { return; @@ -5138,7 +5137,7 @@ static void mp_flush_variable (MP mp, mp_node p, mp_node t, int discard_suffixes if (discard_suffixes) { mp_flush_below_variable(mp, p); } else { - if (mp_type(p) == mp_structured_type) { + if (p->type == mp_structured_type) { p = mp_get_attribute_head(p); } mp_recycle_value(mp, p); @@ -5154,28 +5153,28 @@ static void mp_flush_below_variable (MP mp, mp_node p); @ @c void mp_flush_below_variable (MP mp, mp_node p) { - if (mp_type(p) != mp_structured_type) { + if (p->type != mp_structured_type) { mp_recycle_value(mp, p); /* this sets |type(p)=undefined| */ } else { mp_node r; mp_node q = mp_get_subscr_head(p); - while (mp_name_type(q) == mp_subscript_operation) { + while (q->name_type == mp_subscript_operation) { mp_flush_below_variable(mp, q); r = q; - q = mp_link(q); + q = q->link; mp_free_value_node(mp, r); } r = mp_get_attribute_head(p); - q = mp_link(r); + q = r->link; mp_recycle_value(mp, r); mp_free_value_node(mp, r); do { mp_flush_below_variable(mp, q); r = q; - q = mp_link(q); + q = q->link; mp_free_value_node(mp, r); } while (q != mp->end_attr); - mp_type(p) = mp_undefined_type; + p->type = mp_undefined_type; } } @@ -5187,7 +5186,7 @@ undefined value should be given, based on the current type before recycling. static int mp_und_type (MP mp, mp_node p) { (void) mp; - switch (mp_type(p)) { + switch (p->type) { case mp_vacuous_type: return mp_undefined_type; case mp_boolean_type: @@ -5213,7 +5212,7 @@ static int mp_und_type (MP mp, mp_node p) case mp_cmykcolor_type: case mp_pair_type: case mp_numeric_type: - return mp_type(p); + return p->type; case mp_known_type: case mp_dependent_type: case mp_proto_dependent_type: @@ -5249,7 +5248,7 @@ static void mp_clear_symbol (MP mp, mp_sym p, int saving) case mp_tag_command: if (q != NULL) { if (saving) { - mp_name_type(q) = mp_saved_root_operation; + q->name_type = mp_saved_root_operation; } else { mp_flush_below_variable(mp, q); mp_free_value_node(mp, q); @@ -5358,7 +5357,7 @@ static void mp_unsave_variable (MP mp) if (eq_type(q) == mp_tag_command) { mp_node pp = q->v.data.node; if (pp != NULL) { - mp_name_type(pp) = mp_root_operation; + pp->name_type = mp_root_operation; } } } @@ -9251,9 +9250,9 @@ chooses one of them. static void mp_find_offset (MP mp, mp_number *x_orig, mp_number *y_orig, mp_knot h) { if (mp_pen_is_elliptical(h)) { - mp_fraction xx, yy; /* untransformed offset for an elliptical pen */ + mp_number xx, yy; /* untransformed offset for an elliptical pen */ mp_number wx, wy, hx, hy; /* the transformation matrix for an elliptical pen */ - mp_fraction d; /* a temporary register */ + mp_number d; /* a temporary register */ new_fraction(xx); new_fraction(yy); new_number(wx); @@ -9439,9 +9438,6 @@ static void mp_pen_bbox (MP mp, mp_knot h) This first set goes into the header @<MPlib internal header stuff@>= -@d mp_fraction mp_number -@d mp_angle mp_number - @d new_number(A) mp->math->md_allocate(mp, &(A), mp_scaled_type) @d new_fraction(A) mp->math->md_allocate(mp, &(A), mp_fraction_type) @d new_angle(A) mp->math->md_allocate(mp, &(A), mp_angle_type) @@ -9630,8 +9626,8 @@ typedef struct mp_shape_node_data *mp_shape_node; @d mp_line_join(A) ((mp_shape_node) (A))->linejoin @d mp_miterlimit(A) ((mp_shape_node) (A))->miterlimit -@d mp_set_linecap(A,B) ((mp_shape_node) (A))->linecap = (short) (B) -@d mp_set_linejoin(A,B) ((mp_shape_node) (A))->linejoin = (short) (B) +@d mp_set_linecap(A,B) ((mp_shape_node) (A))->linecap = (unsigned char) (B) +@d mp_set_linejoin(A,B) ((mp_shape_node) (A))->linejoin = (unsigned char) (B) @d mp_pre_script(A) ((mp_shape_node) (A))->pre_script @d mp_post_script(A) ((mp_shape_node) (A))->post_script @@ -9659,7 +9655,7 @@ be transformed without touching the picture that |dash_p| points to. static mp_node mp_new_shape_node (MP mp, mp_knot p, int type) { mp_shape_node t = mp_allocate_node(mp, sizeof(mp_shape_node_data)); - mp_type(t) = type; + t->type = type; mp_path_ptr(t) = p; mp_pen_ptr(t) = NULL; /* |NULL| means don't use a pen */ mp_dash_ptr(t) = NULL; @@ -9819,12 +9815,12 @@ For this reason, each clipping or |setbounds| operation is represented by a pair of nodes: first comes a node whose |path_ptr| gives the relevant path, then there is the list of objects to clip or bound followed by a closing node. -@d mp_has_color(A) (mp_type((A))<mp_start_clip_node_type) /* does a graphical object have color fields? */ -@d mp_has_script(A) (mp_type((A))<=mp_start_bounds_node_type) /* does a graphical object have color fields? */ -@d mp_has_pen(A) (mp_type((A))<=mp_stroked_node_type) /* does a graphical object have a |mp_pen_ptr| field? */ +@d mp_has_color(A) ((A)->type < mp_start_clip_node_type) /* does a graphical object have color fields? */ +@d mp_has_script(A) ((A)->type <= mp_start_bounds_node_type) /* does a graphical object have color fields? */ +@d mp_has_pen(A) ((A)->type <= mp_stroked_node_type) /* does a graphical object have a |mp_pen_ptr| field? */ -@d mp_is_start_or_stop(A) (mp_type((A))>=mp_start_clip_node_type) -@d mp_is_stop(A) (mp_type((A))>=mp_stop_clip_node_type) +@d mp_is_start_or_stop(A) ((A)->type >= mp_start_clip_node_type) +@d mp_is_stop(A) ((A)->type >= mp_stop_clip_node_type) @<MPlib internal header stuff@>= typedef struct mp_start_node_data { @@ -9863,9 +9859,8 @@ static mp_node mp_new_bounds_node (MP mp, mp_knot p, int c) case mp_start_bounds_node_type: { mp_start_node t = (mp_start_node) mp_allocate_node(mp, sizeof(mp_start_node_data)); - mp_type(t) = c; + t->type = c; t->path = p; - t->link = NULL; t->stacking = round_unscaled(internal_value(mp_stacking_internal)); mp_pre_script(t) = NULL; mp_post_script(t) = NULL; @@ -9877,8 +9872,7 @@ static mp_node mp_new_bounds_node (MP mp, mp_knot p, int c) case mp_stop_bounds_node_type: { mp_stop_node t = (mp_stop_node) mp_allocate_node(mp, sizeof(mp_stop_node_data)); - mp_type(t) = c; - t->link = NULL; + t->type = c; t->stacking = round_unscaled(internal_value(mp_stacking_internal)); return (mp_node) t; } @@ -9959,7 +9953,7 @@ static mp_dash_node mp_get_dash_node (MP mp) new_number(p->start_x); new_number(p->stop_x); new_number(p->dash_y); - mp_type(p) = mp_dash_node_type; + p->type = mp_dash_node_type; return p; } @@ -10039,7 +10033,7 @@ word and a pointer to the tail of the object list in the last word. static mp_edge_header_node mp_get_edge_header_node (MP mp) { mp_edge_header_node p = (mp_edge_header_node) mp_allocate_node(mp, sizeof(mp_edge_header_node_data)); - mp_type(p) = mp_edge_header_node_type; + p->type = mp_edge_header_node_type; new_number(p->start_x); new_number(p->stop_x); new_number(p->dash_y); @@ -10056,7 +10050,7 @@ static void mp_init_edges (MP mp, mp_edge_header_node h) /* initialize an edge header to NULL values */ mp_set_dash_list(h, mp->null_dash); mp_obj_tail(h) = mp_edge_list(h); - mp_link(mp_edge_list(h)) = NULL; + mp_edge_list(h)->link = NULL; mp_edge_ref_count(h) = 0; mp_init_bbox(mp, h); } @@ -10086,10 +10080,10 @@ void mp_toss_edges (MP mp, mp_edge_header_node h) mp_node q; /* pointers that scan the list being recycled */ mp_edge_header_node r; /* an edge structure that object |p| refers to */ mp_flush_dash_list(mp, h); - q = mp_link(mp_edge_list(h)); + q = mp_edge_list(h)->link; while (q != NULL) { mp_node p = q; - q = mp_link(q); + q = q->link; r = mp_toss_gr_object(mp, p); if (r != NULL) { mp_delete_edge_ref(mp, r); @@ -10111,7 +10105,7 @@ void mp_flush_dash_list (MP mp, mp_edge_header_node h) mp_dash_node q = mp_get_dash_list(h); while (q != mp->null_dash) { mp_dash_node p = q; - q = (mp_dash_node) mp_link(q); + q = (mp_dash_node) q->link; mp_free_node(mp, (mp_node) p, sizeof(mp_dash_node_data)); } mp_set_dash_list(h, mp->null_dash); @@ -10120,7 +10114,7 @@ void mp_flush_dash_list (MP mp, mp_edge_header_node h) mp_edge_header_node mp_toss_gr_object (MP mp, mp_node p) { /* returns an edge structure that needs to be dereferenced */ - switch (mp_type(p)) { + switch (p->type) { case mp_fill_node_type: case mp_stroked_node_type: return mp_free_shape_node(mp, (mp_shape_node) p); @@ -10154,7 +10148,7 @@ static mp_edge_header_node mp_private_edges (MP mp, mp_edge_header_node h) mp_edge_header_node hh; /* the edge header for the new copy */ mp_dash_node p, pp; /* pointers for copying the dash list */ mp_edge_ref_count(h) -= 1; - hh = (mp_edge_header_node) mp_copy_objects (mp, mp_link(mp_edge_list(h)), NULL); + hh = (mp_edge_header_node) mp_copy_objects (mp, mp_edge_list(h)->link, NULL); @<Copy the dash list from |h| to |hh|@> @<Copy the bounding box information from |h| to |hh| and make |mp_bblast(hh)| point into the new object list@> return hh; @@ -10168,13 +10162,13 @@ assumptions@> pp = (mp_dash_node) hh; p = mp_get_dash_list(h); while ((p != mp->null_dash)) { - mp_link(pp) = (mp_node) mp_get_dash_node(mp); - pp = (mp_dash_node) mp_link(pp); + pp->link = (mp_node) mp_get_dash_node(mp); + pp = (mp_dash_node) pp->link; number_clone(pp->start_x, p->start_x); number_clone(pp->stop_x, p->stop_x); - p = (mp_dash_node) mp_link(p); + p = (mp_dash_node) p->link; } -mp_link(pp) = (mp_node) mp->null_dash; +pp->link = (mp_node) mp->null_dash; number_clone(hh->dash_y, h->dash_y); @ |h| is an edge structure @@ -10222,12 +10216,12 @@ static mp_dash_object *mp_export_dashes (MP mp, mp_shape_node q, mp_number *w) set_number_from_subtraction(arg1, p->stop_x, p->start_x); take_scaled(ret, arg1, scf); dashes[(num_dashes - 1)] = number_to_double(ret); - set_number_from_subtraction(arg1, ((mp_dash_node) mp_link(p))->start_x, p->stop_x); + set_number_from_subtraction(arg1, ((mp_dash_node) p->link)->start_x, p->stop_x); take_scaled(ret, arg1, scf); dashes[(num_dashes)] = number_to_double(ret); dashes[(num_dashes + 1)] = -1.0; /* terminus */ num_dashes += 2; - p = (mp_dash_node) mp_link(p); + p = (mp_dash_node) p->link; } d->array = dashes; mp_dash_offset(mp, &dashoff, h); @@ -10255,8 +10249,8 @@ while ((p != (mp_dash_node) mp_bblast(h))) { mp_confusion(mp, "boundingbox last"); @:this can't happen bblast}{\quad bblast@> } else { - p = (mp_dash_node) mp_link(p); - pp = (mp_dash_node) mp_link(pp); + p = (mp_dash_node) p->link; + pp = (mp_dash_node) pp->link; } } mp_bblast(hh) = (mp_node) pp; @@ -10281,13 +10275,13 @@ mp_edge_header_node mp_copy_objects (MP mp, mp_node p, mp_node q) { @<Make |mp_link(pp)| point to a copy of object |p|, and update |p| and |pp|@> } mp_obj_tail(hh) = pp; - mp_link(pp) = NULL; + pp->link = NULL; return hh; } @ @<Make |mp_link(pp)| point to a copy of object |p|, and update |p| and |pp|@>= { - switch (mp_type(p)) { + switch (p->type) { case mp_fill_node_type: case mp_stroked_node_type: k = sizeof(mp_shape_node_data); @@ -10305,16 +10299,16 @@ mp_edge_header_node mp_copy_objects (MP mp, mp_node p, mp_node q) { default: break; } - mp_link(pp) = mp_allocate_node(mp, (size_t) k); /* |gr_object| */ - pp = mp_link(pp); + pp->link = mp_allocate_node(mp, (size_t) k); /* |gr_object| */ + pp = pp->link; memcpy(pp, p, (size_t) k); pp->link = NULL; @<Fix anything in graphical object |pp| that should differ from the corresponding field in |p|@> - p = mp_link(p); + p = p->link; } @ @<Fix anything in graphical object |pp| that should differ from the...@>= -switch (mp_type(p)) { +switch (p->type) { case mp_fill_node_type: case mp_stroked_node_type: { @@ -10383,7 +10377,7 @@ static mp_node mp_skip_1component (MP mp, mp_node p) ++lev; } } - p = mp_link(p); + p = p->link; } while (lev != 0); return p; } @@ -10400,10 +10394,10 @@ void mp_print_edges (MP mp, mp_node h, const char *s, int nuline) mp_number scf; /* a scale factor for the dash pattern */ new_number(scf); mp_print_diagnostic(mp, "Edge structure", s, nuline); - while (mp_link(p) != NULL) { - p = mp_link(p); + while (p->link != NULL) { + p = p->link; mp_print_ln(mp); - switch (mp_type(p)) { + switch (p->type) { @<Cases for printing graphical object node |p|@> default: mp_print_str(mp, "[unknown object type!]"); @@ -10579,10 +10573,10 @@ if ((ppd == mp->null_dash) || number_negative(hhd->dash_y)) { take_scaled(ret, arg1, scf); print_number( ret); mp_print_str(mp, " off "); - set_number_from_subtraction(arg1, ((mp_dash_node) mp_link(ppd))->start_x, ppd->stop_x); + set_number_from_subtraction(arg1, ((mp_dash_node) ppd->link)->start_x, ppd->stop_x); take_scaled(ret, arg1, scf); print_number(ret); - ppd = (mp_dash_node) mp_link(ppd); + ppd = (mp_dash_node) ppd->link; if (ppd != mp->null_dash) { mp_print_chr(mp, ' '); } @@ -10669,9 +10663,9 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) @<Other local variables in |make_dashes|@> new_number(y0); /* the initial $y$ coordinate */ p0 = NULL; - p = mp_link(mp_edge_list(h)); + p = mp_edge_list(h)->link; while (p != NULL) { - if (mp_type(p) != mp_stroked_node_type) { + if (p->type != mp_stroked_node_type) { @<Complain that the edge structure contains a node of the wrong type and |goto not_found|@> } pp = mp_path_ptr((mp_shape_node) p); @@ -10681,7 +10675,7 @@ static mp_edge_header_node mp_make_dashes (MP mp, mp_edge_header_node h) } @<Make |d| point to a new dash node created from stroke |p| and path |pp| or |goto not_found| if there is an error@> @<Insert |d| into the dash list and |goto not_found| if there is an error@> - p = mp_link(p); + p = p->link; } if (mp_get_dash_list(h) == mp->null_dash) { goto NOT_FOUND; /* No error message */ @@ -10825,20 +10819,20 @@ if (! number_equal(((mp_shape_node) p)->red, ((mp_shape_node) p0)->red) @ @<Insert |d| into the dash list and |goto not_found| if there is an error@>= number_clone(mp->null_dash->start_x, d->stop_x); dd = (mp_dash_node) h; /* this makes |mp_link(dd)=mp_get_dash_list(h)| */ -while (number_less(((mp_dash_node) mp_link(dd))->start_x, d->stop_x)) { - dd = (mp_dash_node) mp_link(dd); +while (number_less(((mp_dash_node) dd->link)->start_x, d->stop_x)) { + dd = (mp_dash_node) dd->link; } if ((dd != (mp_dash_node) h) && number_greater(dd->stop_x, d->start_x)) { mp_x_retrace_error(mp); goto NOT_FOUND; } -mp_link(d) = mp_link(dd); -mp_link(dd) = (mp_node) d; +d->link = dd->link; +dd->link = (mp_node) d; @ @<Set |dash_y(h)| and merge the first and last dashes if necessary@>= d = mp_get_dash_list(h); -while (mp_link(d) != (mp_node) mp->null_dash) { - d = (mp_dash_node) mp_link(d); +while (d->link != (mp_node) mp->null_dash) { + d = (mp_dash_node) d->link; } dd = mp_get_dash_list(h); set_number_from_subtraction(h->dash_y, d->stop_x, dd->start_x); @@ -10849,7 +10843,7 @@ set_number_from_subtraction(h->dash_y, d->stop_x, dd->start_x); if (number_greater(absval, h->dash_y) ) { number_clone(h->dash_y, absval); } else if (d != dd) { - mp_set_dash_list(h, mp_link(dd)); + mp_set_dash_list(h, dd->link); set_number_from_addition(d->stop_x, dd->stop_x, h->dash_y); mp_free_node(mp, (mp_node) dd, sizeof(mp_dash_node_data)); } @@ -10873,11 +10867,11 @@ nodes, we must be prepared to break up these dashes into smaller dashes. { mp_number hsf; /* the dash pattern from |hh| gets scaled by this */ new_number(hsf); -d = (mp_dash_node) h; /* now |mp_link(d)=mp_get_dash_list(h)| */ -while (mp_link(d) != (mp_node) mp->null_dash) { - ds = mp_dash_info(mp_link(d)); +d = (mp_dash_node) h; /* now |d->link=mp_get_dash_list(h)| */ +while (d->link != (mp_node) mp->null_dash) { + ds = mp_dash_info(d->link); if (ds == NULL) { - d = (mp_dash_node) mp_link(d); + d = (mp_dash_node) d->link; } else { hh = (mp_edge_header_node) mp_dash_ptr(ds); number_clone(hsf, ((mp_shape_node) ds)->dashscale); @@ -10886,7 +10880,7 @@ while (mp_link(d) != (mp_node) mp->null_dash) { @:this can't happen dash0}{\quad dash1@> return NULL; } else if (number_zero(((mp_dash_node) hh)->dash_y )) { - d = (mp_dash_node) mp_link(d); + d = (mp_dash_node) d->link; } else if (mp_get_dash_list (hh) == NULL) { mp_confusion(mp, "dash list"); @:this can't happen dash1}{\quad dash1@> @@ -10910,7 +10904,7 @@ mp_number dashoff; mp_number r1, r2; new_number(r1); new_number(r2); -dln = (mp_dash_node) mp_link(d); +dln = (mp_dash_node) d->link; dd = mp_get_dash_list(hh); new_number(xoff); new_number(dashoff); @@ -10928,14 +10922,14 @@ number_clone(mp->null_dash->stop_x, mp->null_dash->start_x); while (number_lessequal(dln->start_x, dln->stop_x)) { @<If |dd| has `fallen off the end', back up to the beginning and fix |xoff|@> @<Insert a dash between |d| and |dln| for the overlap with the offset version of |dd|@> - dd = (mp_dash_node) mp_link(dd); + dd = (mp_dash_node) dd->link; take_scaled(r1, hsf, dd->start_x); set_number_from_addition(dln->start_x , xoff, r1); } free_number(xoff); free_number(r1); free_number(r2); -mp_link(d) = mp_link(dln); +d->link = dln->link; mp_free_node(mp, (mp_node) dln, sizeof(mp_dash_node_data)); @ The name of this module is a bit of a lie because we just find the first |dd| @@ -10950,7 +10944,7 @@ between |dd| and its predecessor. take_scaled(r1, hsf, dd->stop_x); number_add(r1, xoff); while (number_less(r1, dln->start_x)) { - dd = (mp_dash_node) mp_link(dd); + dd = (mp_dash_node) dd->link; take_scaled(r1, hsf, dd->stop_x); number_add(r1, xoff); } @@ -10976,9 +10970,9 @@ if (dd == mp->null_dash) { take_scaled(r1, hsf, dd->start_x); number_add(r1, xoff); if (number_lessequal(r1, dln->stop_x)) { - mp_link(d) = (mp_node) mp_get_dash_node(mp); - d = (mp_dash_node) mp_link(d); - mp_link(d) = (mp_node) dln; + d->link = (mp_node) mp_get_dash_node(mp); + d = (mp_dash_node) d->link; + d->link = (mp_node) dln; take_scaled(r1, hsf, dd->start_x ); number_add(r1, xoff); if (number_greater(dln->start_x, r1)) { @@ -11028,7 +11022,7 @@ to be stroked with the pen~|pp|. static void mp_box_ends (MP mp, mp_knot p, mp_knot pp, mp_edge_header_node h) { if (mp_right_type(p) != mp_endpoint_knot) { - mp_fraction dx, dy; /* a unit vector in the direction out of the path at~|p| */ + mp_number dx, dy; /* a unit vector in the direction out of the path at~|p| */ mp_number d; /* a factor for adjusting the length of |(dx,dy)| */ mp_number z; /* a coordinate being tested against the bounding box */ mp_number xx, yy; /* the extreme pen vertex in the |(dx,dy)| direction */ @@ -11172,10 +11166,10 @@ void mp_set_bbox (MP mp, mp_edge_header_node h, int top_level) break; } - while (mp_link(mp_bblast(h)) != NULL) { - mp_node p = mp_link(mp_bblast(h)); /* a graphical object being considered */ + while (mp_bblast(h)->link != NULL) { + mp_node p = mp_bblast(h)->link; /* a graphical object being considered */ mp_bblast(h) = p; - switch (mp_type(p)) { + switch (p->type) { case mp_stop_clip_node_type: if (top_level) { mp_confusion(mp, "clip"); @@ -11219,14 +11213,14 @@ case mp_stop_bounds_node_type: { int lev = 1; while (lev != 0) { - if (mp_link(p) == NULL) { + if (p->link == NULL) { mp_confusion(mp, "bounds"); @:this can't happen bbox2}{\quad bbox2@> } else { - p = mp_link(p); - if (mp_type(p) == mp_start_bounds_node_type) { + p = p->link; + if (p->type == mp_start_bounds_node_type) { ++lev; - } else if (mp_type(p) == mp_stop_bounds_node_type) { + } else if (p->type == mp_stop_bounds_node_type) { --lev; } } @@ -12390,7 +12384,7 @@ static mp_knot mp_make_envelope (MP mp, mp_knot c, mp_knot h, int linejoin, int mp_knot w, w0; /* the pen knot for the current offset */ int k, k0; /* controls pen edge insertion */ mp_number qx, qy; /* unshifted coordinates of |q| */ - mp_fraction dxin, dyin, dxout, dyout; /* directions at |q| when square or mitered */ + mp_number dxin, dyin, dxout, dyout; /* directions at |q| when square or mitered */ int join_type = 0; /* codes |0..3| for mitered, round, beveled, or square */ @<Other local variables for |make_envelope|@> new_number(max_ht); @@ -13937,7 +13931,7 @@ static void mp_new_indep (MP mp, mp_node p) if (mp->serial_no >= max_integer) { mp_fatal_error(mp, "Variable instance identifiers exhausted"); } - mp_type(p) = mp_independent_type; + p->type = mp_independent_type; mp->serial_no = mp->serial_no + 1; mp_set_indep_scale(p, 0); mp_set_indep_value(p, mp->serial_no); @@ -14011,7 +14005,7 @@ inline static void do_set_dep_value (MP mp, mp_value_node p, mp_number *q); static mp_value_node mp_get_dep_node (MP mp) { mp_value_node p = (mp_value_node) mp_new_value_node(mp); - mp_type(p) = mp_dep_node_type; + p->type = mp_dep_node_type; return p; } @@ -14080,7 +14074,7 @@ void mp_print_dependency (MP mp, mp_value_node p, int t) if (! number_equal(v, unity_t)) { print_number(v); } - if (mp_type(q) != mp_independent_type) { + if (q->type != mp_independent_type) { mp_confusion(mp, "dependency"); } else { mp_print_variable_name(mp, q); @@ -14089,7 +14083,7 @@ void mp_print_dependency (MP mp, mp_value_node p, int t) mp_print_str(mp, "*4"); number_add_scaled(v, -2); } - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; } } } @@ -14100,7 +14094,7 @@ returned by the following simple function. @c static void mp_max_coef (MP mp, mp_number *x, mp_value_node p) { - mp_number(absv); + mp_number absv; new_number(absv); set_number_to_zero(*x); while (mp_get_dep_info(p) != NULL) { @@ -14108,7 +14102,7 @@ static void mp_max_coef (MP mp, mp_number *x, mp_value_node p) if (number_greater(absv, *x)) { number_clone(*x, absv); } - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; } free_number(absv); } @@ -14216,13 +14210,13 @@ static mp_value_node mp_p_plus_fq (MP mp, free_number(r1); mp_set_dep_value(p, v); s = p; - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; number_abs_clone(absv, v); if (number_less(absv, threshold)) { mp_free_dep_node(mp, s); } else { if (number_greaterequal(absv, coef_bound_k) && mp->watch_coefs) { - mp_type(qq) = independent_needing_fix; + qq->type = independent_needing_fix; /* If we set this , then we can drop |(mp_type(pp) == independent_needing_fix && mp->fix_needed)| later @@ -14236,20 +14230,20 @@ static mp_value_node mp_p_plus_fq (MP mp, } free_number(absv); pp = mp_get_dep_info(p); - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; qq = mp_get_dep_info(q); } } else { if (pp == NULL) { set_number_to_negative_inf(v); - } else if (mp_type(pp) == mp_independent_type || (mp_type(pp) == independent_needing_fix && mp->fix_needed)) { + } else if (pp->type == mp_independent_type || (pp->type == independent_needing_fix && mp->fix_needed)) { set_number_from_scaled(v, mp_get_indep_value(pp)); } else { number_clone(v, mp_get_value_number(pp)); } if (qq == NULL) { set_number_to_negative_inf(vv); - } else if (mp_type(qq) == mp_independent_type || (mp_type(qq) == independent_needing_fix && mp->fix_needed)) { + } else if (qq->type == mp_independent_type || (qq->type == independent_needing_fix && mp->fix_needed)) { set_number_from_scaled(vv, mp_get_indep_value(qq)); } else { number_clone(vv, mp_get_value_number(qq)); @@ -14279,19 +14273,19 @@ static mp_value_node mp_p_plus_fq (MP mp, mp_set_dep_info(s, qq); mp_set_dep_value(s, v); if (number_greaterequal(absv, coef_bound_k) && mp->watch_coefs) { - mp_type(qq) = independent_needing_fix; + qq->type = independent_needing_fix; mp->fix_needed = 1; } mp_set_link(r, s); r = s; } - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; qq = mp_get_dep_info(q); free_number(absv); } else { mp_set_link(r, p); r = p; - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; pp = mp_get_dep_info(p); } } @@ -14321,7 +14315,7 @@ static mp_value_node mp_p_plus_fq (MP mp, free_number(half_threshold); free_number(v); free_number(vv); - return (mp_value_node) mp_link(mp->temp_head); + return (mp_value_node) mp->temp_head->link; } @ It is convenient to have another subroutine for the special case of |p_plus_fq| @@ -14358,14 +14352,14 @@ static mp_value_node mp_p_plus_q (MP mp, mp_value_node p, mp_value_node q, mp_va set_number_from_addition(v, mp_get_dep_value(p), mp_get_dep_value(q)); mp_set_dep_value(p, v); s = p; - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; pp = mp_get_dep_info(p); number_abs_clone(test, v); if (number_less(test, threshold)) { mp_free_dep_node(mp, s); } else { if (number_greaterequal(test, coef_bound_k) && mp->watch_coefs) { - mp_type(qq) = independent_needing_fix; + qq->type = independent_needing_fix; /* If we set this , then we can drop |(mp_type(pp) == independent_needing_fix && mp->fix_needed)| later @@ -14378,21 +14372,21 @@ static mp_value_node mp_p_plus_q (MP mp, mp_value_node p, mp_value_node q, mp_va r = s; } free_number(test); - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; qq = mp_get_dep_info(q); } } else { if (pp == NULL) { set_number_to_zero(v); - } else if (mp_type(pp) == mp_independent_type || (mp_type(pp) == independent_needing_fix && mp->fix_needed)) { + } else if (pp->type == mp_independent_type || (pp->type == independent_needing_fix && mp->fix_needed)) { set_number_from_scaled(v, mp_get_indep_value(pp)); } else { number_clone(v, mp_get_value_number(pp)); } if (qq == NULL) { set_number_to_zero(vv); - } else if (mp_type(qq) == mp_independent_type || (mp_type(qq) == independent_needing_fix && mp->fix_needed)) { + } else if (qq->type == mp_independent_type || (qq->type == independent_needing_fix && mp->fix_needed)) { set_number_from_scaled(vv, mp_get_indep_value(qq)); } else { number_clone(vv, mp_get_value_number(qq)); @@ -14401,14 +14395,14 @@ static mp_value_node mp_p_plus_q (MP mp, mp_value_node p, mp_value_node q, mp_va s = mp_get_dep_node(mp); mp_set_dep_info(s, qq); mp_set_dep_value(s, mp_get_dep_value(q)); - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; qq = mp_get_dep_info(q); mp_set_link(r, s); r = s; } else { mp_set_link(r, p); r = p; - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; pp = mp_get_dep_info(p); } } @@ -14425,7 +14419,7 @@ static mp_value_node mp_p_plus_q (MP mp, mp_value_node p, mp_value_node q, mp_va free_number(v); free_number(vv); free_number(threshold); - return (mp_value_node) mp_link(mp->temp_head); + return (mp_value_node) mp->temp_head->link; } @ A somewhat simpler routine will multiply a dependency list by a given @@ -14460,18 +14454,18 @@ static mp_value_node mp_p_times_v (MP mp, mp_value_node p, mp_number *v, int t0, } number_abs_clone(test, w); if (number_lessequal(test, threshold)) { - s = (mp_value_node) mp_link(p); + s = (mp_value_node) p->link; mp_free_dep_node(mp, p); p = s; } else { if (number_greaterequal(test, coef_bound_k)) { mp->fix_needed = 1; - mp_type(mp_get_dep_info(p)) = independent_needing_fix; + mp_get_dep_info(p)->type = independent_needing_fix; } mp_set_link(r, p); r = p; mp_set_dep_value(p, w); - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; } free_number(test); } @@ -14489,7 +14483,7 @@ static mp_value_node mp_p_times_v (MP mp, mp_value_node p, mp_number *v, int t0, } free_number(w); free_number(threshold); - return (mp_value_node) mp_link(mp->temp_head); + return (mp_value_node) mp->temp_head->link; } @ Similarly, we sometimes need to divide a dependency list by a given |scaled| @@ -14540,18 +14534,18 @@ mp_value_node mp_p_over_v (MP mp, mp_value_node p, mp_number *v_orig, int t0, in new_number(test); number_abs_clone(test, w); if (number_lessequal(test, threshold)) { - s = (mp_value_node) mp_link(p); + s = (mp_value_node) p->link; mp_free_dep_node(mp, p); p = s; } else { if (number_greaterequal(test, coef_bound_k)) { mp->fix_needed = 1; - mp_type(mp_get_dep_info(p)) = independent_needing_fix; + mp_get_dep_info(p)->type = independent_needing_fix; } mp_set_link(r, p); r = p; mp_set_dep_value(p, w); - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; } free_number(test); } @@ -14567,7 +14561,7 @@ mp_value_node mp_p_over_v (MP mp, mp_value_node p, mp_number *v_orig, int t0, in free_number(v); free_number(w); free_number(threshold); - return (mp_value_node) mp_link(mp->temp_head); + return (mp_value_node) mp->temp_head->link; } @ Here's another utility routine for dependency lists. When an independent @@ -14589,7 +14583,7 @@ static mp_value_node mp_p_with_x_becoming_q (MP mp, mp_value_node p, mp_node x, int sx = mp_get_indep_value(x); /* serial number of |x| */ while (mp_get_dep_info(s) != NULL && mp_get_indep_value(mp_get_dep_info(s)) > sx) { r = s; - s = (mp_value_node) mp_link(s); + s = (mp_value_node) s->link; } if (mp_get_dep_info(s) == NULL || mp_get_dep_info(s) != x) { return p; @@ -14597,10 +14591,10 @@ static mp_value_node mp_p_with_x_becoming_q (MP mp, mp_value_node p, mp_node x, mp_value_node ret; mp_number v1; mp_set_link(mp->temp_head, p); - mp_set_link(r, mp_link(s)); + mp_set_link(r, s->link); new_number_clone(v1, mp_get_dep_value(s)); mp_free_dep_node(mp, s); - ret = mp_p_plus_fq(mp, (mp_value_node) mp_link(mp->temp_head), &v1, (mp_value_node) q, t, mp_dependent_type); + ret = mp_p_plus_fq(mp, (mp_value_node) mp->temp_head->link, &v1, (mp_value_node) q, t, mp_dependent_type); free_number(v1); return ret; } @@ -14638,12 +14632,12 @@ static void mp_make_known (MP mp, mp_value_node p, mp_value_node q); @ @c void mp_make_known (MP mp, mp_value_node p, mp_value_node q) { - mp_variable_type t = mp_type(p); /* the previous type */ + mp_variable_type t = p->type; /* the previous type */ mp_number absp; new_number(absp); - mp_set_prev_dep(mp_link(q), mp_get_prev_dep(p)); - mp_set_link(mp_get_prev_dep(p), mp_link(q)); - mp_type(p) = mp_known_type; + mp_set_prev_dep(q->link, mp_get_prev_dep(p)); + mp_set_link(mp_get_prev_dep(p), q->link); + p->type = mp_known_type; mp_set_value_number(p, mp_get_dep_value(q)); mp_free_dep_node(mp, q); number_abs_clone(absp, mp_get_value_number(p)); @@ -14681,7 +14675,7 @@ static void mp_fix_dependencies (MP mp); @ @c static void mp_fix_dependencies (MP mp) { - mp_value_node r = (mp_value_node) mp_link(mp->dep_head); + mp_value_node r = (mp_value_node) mp->dep_head->link; mp_value_node s = NULL; while (r != mp->dep_head) { /* @@ -14695,40 +14689,40 @@ static void mp_fix_dependencies (MP mp) if (t == r) { q = (mp_value_node) mp_get_dep_list(t); } else { - q = (mp_value_node) mp_link(r); + q = (mp_value_node) r->link; } x = mp_get_dep_info(q); if (x == NULL) { break; - } else if (mp_type(x) <= independent_being_fixed) { - if (mp_type(x) < independent_being_fixed) { + } else if (x->type <= independent_being_fixed) { + if (x->type < independent_being_fixed) { mp_value_node p = mp_get_dep_node(mp); mp_set_link(p, s); s = p; mp_set_dep_info(s, x); - mp_type(x) = independent_being_fixed; + x->type = independent_being_fixed; } mp_set_dep_value(q, mp_get_dep_value(q)); number_divide_int(mp_get_dep_value(q), 4); if (number_zero(mp_get_dep_value(q))) { - mp_set_link(r, mp_link(q)); + mp_set_link(r, q->link); mp_free_dep_node(mp, q); q = r; } } r = q; } - r = (mp_value_node) mp_link(q); + r = (mp_value_node) q->link; if (q == (mp_value_node) mp_get_dep_list(t)) { mp_make_known(mp, t, q); } } while (s != NULL) { - mp_value_node p = (mp_value_node) mp_link(s); + mp_value_node p = (mp_value_node) s->link; mp_node x = mp_get_dep_info(s); mp_free_dep_node(mp, s); s = p; - mp_type(x) = mp_independent_type; + x->type = mp_independent_type; mp_set_indep_scale(x, mp_get_indep_scale(x) + 2); } mp->fix_needed = 0; @@ -14743,10 +14737,10 @@ of list~|p|. static void mp_new_dep (MP mp, mp_node q, mp_variable_type newtype, mp_value_node p) { mp_node r; /* what used to be the first dependency */ - mp_type(q) = newtype; + q->type = newtype; mp_set_dep_list(q, p); mp_set_prev_dep(q, (mp_node) mp->dep_head); - r = mp_link(mp->dep_head); + r = mp->dep_head->link; mp_set_link(mp->dep_final, r); mp_set_prev_dep(r, (mp_node) mp->dep_final); mp_set_link(mp->dep_head, q); @@ -14809,8 +14803,8 @@ static mp_value_node mp_copy_dep_list (MP mp, mp_value_node p) break; } else { mp_set_link(mp->dep_final, mp_get_dep_node(mp)); - mp->dep_final = (mp_value_node) mp_link(mp->dep_final); - p = (mp_value_node) mp_link(p); + mp->dep_final = (mp_value_node) mp->dep_final->link; + p = (mp_value_node) p->link; } } return q; @@ -14858,20 +14852,20 @@ static void mp_linear_eq (MP mp, mp_value_node p, int t) display_new_dependency(mp, p, (mp_node) x, n); } prev_r = (mp_value_node) mp->dep_head; - r = (mp_value_node) mp_link(mp->dep_head); + r = (mp_value_node) mp->dep_head->link; while (r != mp->dep_head) { mp_value_node s = (mp_value_node) mp_get_dep_list(r); - mp_value_node q = mp_p_with_x_becoming_q(mp, s, x, (mp_node) p, mp_type(r)); + mp_value_node q = mp_p_with_x_becoming_q(mp, s, x, (mp_node) p, r->type); if (mp_get_dep_info(q) == NULL) { mp_make_known(mp, r, q); } else { mp_set_dep_list(r, q); do { - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; } while (mp_get_dep_info(q) != NULL); prev_r = q; } - r = (mp_value_node) mp_link(prev_r); + r = (mp_value_node) prev_r->link; } if (n > 0) { p = divide_p_by_2_n(mp, p, n); @@ -14889,7 +14883,7 @@ static mp_value_node find_node_with_largest_coefficient (MP mp, mp_value_node p, mp_number vabs; /* its absolute value of v*/ mp_number rabs; /* the absolute value of |mp_get_dep_value(r)| */ mp_value_node q = p; - mp_value_node r = (mp_value_node) mp_link(p); + mp_value_node r = (mp_value_node) p->link; new_number(vabs); new_number(rabs); number_clone(*v, mp_get_dep_value(q)); @@ -14900,7 +14894,7 @@ static mp_value_node find_node_with_largest_coefficient (MP mp, mp_value_node p, q = r; number_clone(*v, mp_get_dep_value(r)); } - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; } free_number(vabs); free_number(rabs); @@ -14922,7 +14916,7 @@ static mp_value_node divide_p_by_minusv_removing_q (MP mp, mp_set_link(s, p); do { if (r == q) { - mp_set_link(s, mp_link(r)); + mp_set_link(s, r->link); mp_free_dep_node(mp, r); } else { mp_number w; /* a tentative coefficient */ @@ -14932,7 +14926,7 @@ static mp_value_node divide_p_by_minusv_removing_q (MP mp, make_fraction(w, mp_get_dep_value(r), *v); number_abs_clone(absw, w); if (number_lessequal(absw, half_fraction_threshold_k)) { - mp_set_link(s, mp_link(r)); + mp_set_link(s, r->link); mp_free_dep_node(mp, r); } else { number_negate(w); @@ -14942,7 +14936,7 @@ static mp_value_node divide_p_by_minusv_removing_q (MP mp, free_number(w); free_number(absw); } - r = (mp_value_node) mp_link(s); + r = (mp_value_node) s->link; } while (mp_get_dep_info(r) != NULL); if (t == mp_proto_dependent_type) { mp_number ret; @@ -14960,7 +14954,7 @@ static mp_value_node divide_p_by_minusv_removing_q (MP mp, free_number(ret); } *final_node = r; - return (mp_value_node) mp_link(mp->temp_head); + return (mp_value_node) mp->temp_head->link; } @ @c @@ -15007,15 +15001,15 @@ static mp_value_node divide_p_by_2_n (MP mp, mp_value_node p, int n) } number_abs_clone(absw, w); if (number_lessequal(absw, half_fraction_threshold_k) && (mp_get_dep_info(r) != NULL)) { - mp_set_link(s, mp_link(r)); + mp_set_link(s, r->link); mp_free_dep_node(mp, r); } else { mp_set_dep_value(r, w); s = r; } - r = (mp_value_node) mp_link(s); + r = (mp_value_node) s->link; } while (mp_get_dep_info(s) != NULL); - pp = (mp_value_node) mp_link(mp->temp_head); + pp = (mp_value_node) mp->temp_head->link; free_number(absw); free_number(w); } @@ -15028,7 +15022,7 @@ static void change_to_known (MP mp, mp_value_node p, mp_node x, mp_value_node fi (void) n; if (mp_get_dep_info(p) == NULL) { mp_number absx; - mp_type(x) = mp_known_type; + x->type = mp_known_type; mp_set_value_number(x, mp_get_dep_value(p)); new_number_abs(absx, mp_get_value_number(x)); if (number_greaterequal(absx, warning_limit_t)) { @@ -15083,8 +15077,8 @@ enthusiasm for such generality, unless they have lots and lots of memory space. static mp_node mp_new_ring_entry (MP mp, mp_node p) { mp_node q = mp_new_value_node(mp); /* the new capsule node */ - mp_name_type(q) = mp_capsule_operation; - mp_type(q) = mp_type(p); + q->name_type = mp_capsule_operation; + q->type = p->type; if (mp_get_value_node(p) == NULL) { mp_set_value_node(q, p); } else { @@ -15124,16 +15118,16 @@ will soon be recycled. @c static void mp_nonlinear_eq (MP mp, mp_value v, mp_node p, int flush_p) { - mp_variable_type t = mp_type(p) - unknown_tag; /* the type of ring |p| */ + mp_variable_type t = p->type - unknown_tag; /* the type of ring |p| */ mp_node q = mp_get_value_node(p); if (flush_p) { - mp_type(p) = mp_vacuous_type; + p->type = mp_vacuous_type; } else { p = q; } do { mp_node r = mp_get_value_node(q); - mp_type(q) = t; + q->type = t; switch (t) { case mp_boolean_type: mp_set_value_number(q, v.data.n); @@ -15305,7 +15299,7 @@ static void mp_show_cmd_mod (MP mp, int c, int m) mp_print_cmd_mod(mp, mp_macro_def_command, c); mp_print_str(mp, "'d macro:"); mp_print_ln(mp); - mp_show_token_list(mp, mp_link(mp_link(cur_mod_node)),0); + mp_show_token_list(mp, cur_mod_node->link->link,0); break; default: mp_print_cmd_mod(mp, c, m); @@ -15697,7 +15691,7 @@ capsule~|p| in abbreviated form. mp_node pp = mp->param_stack[param_start]; mp_print_nl(mp, "<for("); if (pp != NULL) { - if (mp_link(pp) == MP_VOID) { + if (pp->link == MP_VOID) { mp_print_exp(mp, pp, 0); /* we're in a |for| loop */ } else { mp_show_token_list(mp, pp, NULL); @@ -15717,12 +15711,12 @@ together, we get the macro's full name. mp_show_token_list(mp, mp->param_stack[param_start + 1], NULL); } else { mp_node qq = pp; - while (mp_link(qq) != NULL) { - qq = mp_link(qq); + while (qq->link != NULL) { + qq = qq->link; } - mp_link(qq) = mp->param_stack[param_start + 1]; + qq->link = mp->param_stack[param_start + 1]; mp_show_token_list(mp, pp, NULL); - mp_link(qq) = NULL; + qq->link = NULL; } } @@ -15811,7 +15805,7 @@ static void mp_end_token_list (MP mp) --mp->param_ptr; p = mp->param_stack[mp->param_ptr]; if (p != NULL) { - if (mp_link(p) == MP_VOID) { + if (p->link == MP_VOID) { /* it's an |expr| parameter */ mp_recycle_value(mp, p); mp_free_value_node(mp, p); @@ -15842,25 +15836,25 @@ static mp_node mp_cur_tok (MP mp) number_clone(save_exp_num, cur_exp_value_number); mp_make_exp_copy(mp, cur_mod_node); p = mp_stash_cur_exp(mp); - mp_link(p) = NULL; + p->link = NULL; mp->cur_exp = save_exp; number_clone(mp->cur_exp.data.n, save_exp_num); free_number(save_exp_num); } else { p = mp_new_token_node(mp); - mp_name_type(p) = mp_token_operation; + p->name_type = mp_token_operation; if (cur_cmd == mp_numeric_command) { mp_set_value_number(p, cur_mod_number); - mp_type(p) = mp_known_type; + p->type = mp_known_type; } else { mp_set_value_str(p, cur_mod_str); - mp_type(p) = mp_string_type; + p->type = mp_string_type; } } } else { p = mp_new_symbolic_node(mp); mp_set_sym_sym(p, cur_sym); - mp_name_type(p) = cur_sym_mod; + p->name_type = cur_sym_mod; } return p; } @@ -16063,7 +16057,7 @@ if (cur_sym != NULL) { // if (cur_sym != NULL) { // mp_node p = mp_new_symbolic_node(mp); // mp_set_sym_sym(p, cur_sym); -// mp_name_type(p) = cur_sym_mod; +// p->name_type = cur_sym_mod; // /* prepare to read the symbolic token again */ // mp_begin_token_list(mp, p, mp_backed_up_text); // } @@ -16170,7 +16164,7 @@ void mp_runaway (MP mp) break; } mp_print_ln(mp); - mp_show_token_list(mp, mp_link(mp->hold_head), NULL); + mp_show_token_list(mp, mp->hold_head->link, NULL); } } @@ -16266,7 +16260,7 @@ void mp_get_next (MP mp) ); goto RESTART; } - mp_str_room(mp, (size_t) (loc - k)); + mp_str_room(mp, loc - k); do { mp_append_char(mp, mp->buffer[k]); ++k; @@ -16316,14 +16310,14 @@ void mp_get_next (MP mp) Input from token list; |goto restart| if end of list or if a parameter needs to be expanded, or |return| if a non-symbolic token is found. */ - if (nloc != NULL && mp_type(nloc) == mp_symbol_node_type) { + if (nloc != NULL && nloc->type == mp_symbol_node_type) { /* symbolic token */ - int cur_sym_mod_ = mp_name_type(nloc); + int cur_sym_mod_ = nloc->name_type; int cur_info = mp_get_sym_info(nloc); set_cur_sym(mp_get_sym_sym(nloc)); set_cur_sym_mod(cur_sym_mod_); /* move to next */ - nloc = mp_link(nloc); + nloc = nloc->link; if (cur_sym_mod_ == mp_expr_operation) { set_cur_cmd(mp_capsule_command); set_cur_mod_node(mp->param_stack[param_start + cur_info]); @@ -16336,8 +16330,8 @@ void mp_get_next (MP mp) } } else if (nloc != NULL) { /* Get a stored numeric or string or capsule token and |return| */ - if (mp_name_type(nloc) == mp_token_operation) { - if (mp_type(nloc) == mp_known_type) { + if (nloc->name_type == mp_token_operation) { + if (nloc->type == mp_known_type) { set_cur_mod_number(mp_get_value_number(nloc)); set_cur_cmd(mp_numeric_command); } else { @@ -16349,7 +16343,7 @@ void mp_get_next (MP mp) set_cur_mod_node(nloc); set_cur_cmd(mp_capsule_command); } - nloc = mp_link(nloc); + nloc = nloc->link; return; } else { /* we are done with this token list */ @@ -16648,7 +16642,7 @@ static mp_node mp_scan_toks (MP mp, mp_command_code terminator, mp_subst_list_it int cur_data_mod = 0; mp_node p = mp->hold_head; /* tail of the token list being built */ int balance = 1; /* left delimiters minus right delimiters */ - mp_link(mp->hold_head) = NULL; + mp->hold_head->link = NULL; while (1) { get_t_next(mp); cur_data = -1; @@ -16669,20 +16663,20 @@ static mp_node mp_scan_toks (MP mp, mp_command_code terminator, mp_subst_list_it if (cur_data != -1) { mp_node pp = mp_new_symbolic_node(mp); mp_set_sym_info(pp, cur_data); - mp_name_type(pp) = cur_data_mod; - mp_link(p) = pp; + pp->name_type = cur_data_mod; + p->link = pp; } else { - mp_link(p) = mp_cur_tok(mp); + p->link = mp_cur_tok(mp); } - p = mp_link(p); + p = p->link; } - mp_link(p) = tail_end; + p->link = tail_end; while (subst_list) { mp_subst_list_item *q = subst_list->link; mp_memory_free(subst_list); subst_list = q; } - return mp_link(mp->hold_head); + return mp->hold_head->link; } @ @<Substitute for |cur_sym|...@>= @@ -16838,10 +16832,10 @@ static void mp_make_op_def (MP mp, int code) q = mp_new_symbolic_node(mp); mp_set_ref_count(q, 0); r = mp_new_symbolic_node(mp); - mp_link(q) = r; + q->link = r; mp_set_sym_info(r, mp_general_macro); - mp_name_type(r) = mp_macro_operation; - mp_link(r) = mp_scan_toks(mp, mp_macro_def_command, qn, NULL, 0); + r->name_type = mp_macro_operation; + r->link = mp_scan_toks(mp, mp_macro_def_command, qn, NULL, 0); mp->scanner_status = mp_normal_state; set_eq_type(mp->warning_info, m); set_equiv_node(mp->warning_info, q); @@ -16898,7 +16892,7 @@ static void mp_scan_def (MP mp, int code) int sym_type; /* |expr_sym|, |suffix_sym|, or |text_sym| */ mp_sym l_delim, r_delim; /* matching delimiters */ int c = mp_general_macro; /* the kind of macro we're defining */ - mp_link(mp->hold_head) = NULL; + mp->hold_head->link = NULL; q = mp_new_symbolic_node(mp); mp_set_ref_count(q, 0); r = NULL; @@ -16917,7 +16911,7 @@ static void mp_scan_def (MP mp, int code) } else { /* |var_def| */ p = mp_scan_declared_variable(mp); - mp_flush_variable(mp, equiv_node(mp_get_sym_sym(p)), mp_link(p), 1); + mp_flush_variable(mp, equiv_node(mp_get_sym_sym(p)), p->link, 1); mp->warning_info_node = mp_find_variable(mp, p); mp_flush_node_list(mp, p); if (mp->warning_info_node == NULL) { @@ -16936,7 +16930,7 @@ static void mp_scan_def (MP mp, int code) n = 3; get_t_next(mp); } - mp_type(mp->warning_info_node) = mp_unsuffixed_macro_type - 2 + n; + mp->warning_info_node->type = mp_unsuffixed_macro_type - 2 + n; /* |mp_suffixed_macro=mp_unsuffixed_macro+1| */ mp_set_value_node(mp->warning_info_node, q); } @@ -16974,9 +16968,9 @@ static void mp_scan_def (MP mp, int code) OKAY: /* Absorb parameter tokens for type |sym_type| */ do { - mp_link(q) = mp_new_symbolic_node(mp); - q = mp_link(q); - mp_name_type(q) = sym_type; + q->link = mp_new_symbolic_node(mp); + q = q->link; + q->name_type = sym_type; mp_set_sym_info(q, k); mp_get_symbol(mp); rp = mp_memory_allocate(sizeof(mp_subst_list_item)); @@ -17046,22 +17040,22 @@ static void mp_scan_def (MP mp, int code) mp_check_equals(mp); p = mp_new_symbolic_node(mp); mp_set_sym_info(p, c); - mp_name_type(p) = mp_macro_operation; - mp_link(q) = p; + p->name_type = mp_macro_operation; + q->link = p; /* Attach the replacement text to the tail of node |p|. We don't put |mp->frozen_end_group| into the replacement text of a |vardef|, because the user may want to redefine |endgroup|. */ if (code == mp_def_code) { - mp_link(p) = mp_scan_toks(mp, mp_macro_def_command, r, NULL, (int) n); + p->link = mp_scan_toks(mp, mp_macro_def_command, r, NULL, (int) n); } else { mp_node qq = mp_new_symbolic_node(mp); mp_set_sym_sym(qq, mp->bg_loc); - mp_link(p) = qq; + p->link = qq; p = mp_new_symbolic_node(mp); mp_set_sym_sym(p, mp->eg_loc); - mp_link(qq) = mp_scan_toks(mp, mp_macro_def_command, r, p, (int) n); + qq->link = mp_scan_toks(mp, mp_macro_def_command, r, p, (int) n); } if (mp->warning_info_node == mp->bad_vardef) { mp_flush_token_list(mp, mp_get_value_node(mp->bad_vardef)); @@ -17076,7 +17070,7 @@ mp_sym eg_loc; /* hash addresses of |begingroup| and |endgroup| */ @ @<Initialize table entries@>= mp->bad_vardef = mp_new_value_node(mp); -mp_name_type(mp->bad_vardef) = mp_root_operation; +mp->bad_vardef->name_type = mp_root_operation; mp_set_value_sym(mp->bad_vardef, mp->frozen_bad_vardef); @ @<Free table entries@>= @@ -17722,11 +17716,11 @@ static void mp_macro_call (MP mp, mp_node def_ref, mp_node arg_list, mp_sym macr @c static void mp_macro_call (MP mp, mp_node def_ref, mp_node arg_list, mp_sym macro_name) { - int n; /* the number of arguments */ - mp_node tail = 0; /* tail of the argument list */ - mp_sym l_delim = NULL; /* a delimiter pair */ - mp_sym r_delim = NULL; /* a delimiter pair */ - mp_node r = mp_link(def_ref); /* current node in the macro's token list */ + int n; /* the number of arguments */ + mp_node tail = 0; /* tail of the argument list */ + mp_sym l_delim = NULL; /* a delimiter pair */ + mp_sym r_delim = NULL; /* a delimiter pair */ + mp_node r = def_ref->link; /* current node in the macro's token list */ mp_add_mac_ref(def_ref); if (arg_list == NULL) { n = 0; @@ -17755,7 +17749,7 @@ if (arg_list != NULL) { mp_node q = (mp_node) mp_get_sym_sym(p); mp_print_arg(mp, q, n, 0, 0); ++n; - p = mp_link(p); + p = p->link; } while (p != NULL); } mp_end_diagnostic(mp, 0); @@ -17772,14 +17766,14 @@ static void mp_print_macro_name (MP mp, mp_node a, mp_sym n) mp_node p = (mp_node) mp_get_sym_sym(a); if (p) { mp_node q = p; /* they traverse the first part of |a| */ - while (mp_link(q) != NULL) { - q = mp_link(q); + while (q->link != NULL) { + q = q->link; } - mp_link(q) = (mp_node) mp_get_sym_sym(mp_link(a)); + q->link = (mp_node) mp_get_sym_sym(a->link); mp_show_token_list(mp, p, NULL); - mp_link(q) = NULL; + q->link = NULL; } else { - mp_print_mp_str(mp,text(mp_get_sym_sym((mp_node) mp_get_sym_sym(mp_link(a))))); + mp_print_mp_str(mp,text(mp_get_sym_sym((mp_node) mp_get_sym_sym(a->link)))); } } } @@ -17790,7 +17784,7 @@ static void mp_print_arg (MP mp, mp_node q, int n, int b, int bb); @ @c static void mp_print_arg (MP mp, mp_node q, int n, int b, int bb) { - if (q && mp_link(q) == MP_VOID) { + if (q && q->link == MP_VOID) { mp_print_nl(mp, "(EXPR"); } else if ((bb < mp_text_operation) && (b != mp_text_macro)) { mp_print_nl(mp, "(SUFFIX"); @@ -17799,7 +17793,7 @@ static void mp_print_arg (MP mp, mp_node q, int n, int b, int bb) } mp_print_int(mp, n); mp_print_str(mp, ")<-"); - if (q && mp_link(q) == MP_VOID) { + if (q && q->link == MP_VOID) { mp_print_exp(mp, q, 1); } else { mp_show_token_list(mp, q, NULL); @@ -17809,16 +17803,16 @@ static void mp_print_arg (MP mp, mp_node q, int n, int b, int bb) @ @<Determine the number |n| of arguments already supplied...@>= n = 1; tail = arg_list; -while (mp_link(tail) != NULL) { +while (tail->link != NULL) { ++n; - tail = mp_link(tail); + tail = tail->link; } @ @<Scan the remaining arguments, if any; set |r|...@>= set_cur_cmd(mp_comma_command + 1); /* anything |<>comma| will do */ -while (mp_name_type(r) == mp_expr_operation || mp_name_type(r) == mp_suffix_operation || mp_name_type(r) == mp_text_operation) { +while (r->name_type == mp_expr_operation || r->name_type == mp_suffix_operation || r->name_type == mp_text_operation) { @<Scan the delimited argument represented by |mp_get_sym_info(r)|@> - r = mp_link(r); + r = r->link; } if (cur_cmd == mp_comma_command) { char msg[256]; @@ -17843,7 +17837,7 @@ if (cur_cmd == mp_comma_command) { if (mp_get_sym_info(r) != mp_general_macro) { @<Scan undelimited argument(s)@> } -r = mp_link(r); +r = r->link; @ At this point, the reader will find it advisable to review the explanation of token list format that was presented earlier, paying special attention to the @@ -17868,7 +17862,7 @@ if (cur_cmd != mp_comma_command) { mp_snprintf(msg, 256, "Missing argument to %s", mp_str(mp, sname)); @.Missing argument...@> delete_str_ref(sname); - if (mp_name_type(r) == mp_suffix_operation || mp_name_type(r) == mp_text_operation) { + if (r->name_type == mp_suffix_operation || r->name_type == mp_text_operation) { mp_set_cur_exp_value_number(mp, &zero_t); /* todo: this was |null| */ mp->cur_exp.type = mp_token_list_type; } else { @@ -17889,7 +17883,7 @@ if (cur_cmd != mp_comma_command) { } @<Scan the argument represented by |mp_get_sym_info(r)|@> if ((cur_cmd != mp_comma_command) && ((cur_cmd != mp_right_delimiter_command) || (equiv_sym(cur_sym) != l_delim))) { - switch (mp_name_type(mp_link(r))) { + switch (r->link->name_type) { case mp_expr_operation: case mp_suffix_operation: case mp_text_operation: @@ -17930,24 +17924,24 @@ pointed to by |cur_exp|, in which case we will have |cur_type=token_list|. } if (number_positive(internal_value(mp_tracing_macros_internal))) { mp_begin_diagnostic(mp); - mp_print_arg(mp, (mp_node) mp_get_sym_sym(p), n, mp_get_sym_info(r), mp_name_type(r)); + mp_print_arg(mp, (mp_node) mp_get_sym_sym(p), n, mp_get_sym_info(r), r->name_type); mp_end_diagnostic(mp, 0); } if (arg_list == NULL) { arg_list = p; } else { - mp_link(tail) = p; + tail->link = p; } tail = p; ++n; } @ @<Scan the argument represented by |mp_get_sym_info(r)|@>= -if (mp_name_type(r) == mp_text_operation) { +if (r->name_type == mp_text_operation) { mp_scan_text_arg(mp, l_delim, r_delim); } else { mp_get_x_next(mp); - if (mp_name_type(r) == mp_suffix_operation) { + if (r->name_type == mp_suffix_operation) { mp_scan_suffix(mp); } else { mp_scan_expression(mp); @@ -17968,7 +17962,7 @@ void mp_scan_text_arg (MP mp, mp_sym l_delim, mp_sym r_delim) mp->warning_info = l_delim; mp->scanner_status = mp_absorbing_state; mp_node p = mp->hold_head; /* list tail */ - mp_link(mp->hold_head) = NULL; + mp->hold_head->link = NULL; while (1) { get_t_next(mp); if (l_delim == NULL) { @@ -17976,10 +17970,10 @@ void mp_scan_text_arg (MP mp, mp_sym l_delim, mp_sym r_delim) } else { @<Adjust the balance for a delimited argument; |break| if done@> } - mp_link(p) = mp_cur_tok(mp); - p = mp_link(p); + p->link = mp_cur_tok(mp); + p = p->link; } - mp_set_cur_exp_node(mp, mp_link(mp->hold_head)); + mp_set_cur_exp_node(mp, mp->hold_head->link); mp->cur_exp.type = mp_token_list_type; mp->scanner_status = mp_normal_state; } @@ -18062,7 +18056,7 @@ if (number_positive(internal_value(mp_tracing_macros_internal))) { if (arg_list == NULL) { arg_list = p; } else { - mp_link(tail) = p; + tail->link = p; } tail = p; ++n; @@ -18123,7 +18117,7 @@ if (n > 0) { do { mp->param_stack[mp->param_ptr] = (mp_node) mp_get_sym_sym(p); ++mp->param_ptr; - p = mp_link(p); + p = p->link; } while (p != NULL); mp_flush_node_list(mp, arg_list); } @@ -18184,7 +18178,7 @@ typedef struct mp_if_node_data *mp_if_node; @c static mp_node mp_get_if_node (MP mp) { mp_if_node p = (mp_if_node) mp_allocate_node(mp, sizeof(mp_if_node_data)); - mp_type(p) = mp_if_node_type; + p->type = mp_if_node_type; return (mp_node) p; } @@ -18272,9 +18266,9 @@ static void mp_pop_condition_stack (MP mp); static void mp_push_condition_stack (MP mp) { mp_node p = mp_get_if_node(mp); - mp_link(p) = mp->cond_ptr; - mp_type(p) = (int) mp->if_limit; - mp_name_type(p) = mp->cur_if; + p->link = mp->cond_ptr; + p->type = (int) mp->if_limit; + p->name_type = mp->cur_if; mp_if_line_field(p) = mp->if_line; mp->cond_ptr = p; mp->if_limit = mp_if_code; @@ -18286,9 +18280,9 @@ static void mp_pop_condition_stack (MP mp) { mp_node p = mp->cond_ptr; mp->if_line = mp_if_line_field(p); - mp->cur_if = mp_name_type(p); - mp->if_limit = mp_type(p); - mp->cond_ptr = mp_link(p); + mp->cur_if = p->name_type; + mp->if_limit = p->type; + mp->cond_ptr = p->link; mp_free_node(mp, p, sizeof(mp_if_node_data)); } @ Here's a procedure that changes the |if_limit| code corresponding to @@ -18307,11 +18301,11 @@ static void mp_change_if_limit (MP mp, int l, mp_node p) mp_confusion(mp, "if"); @:this can't happen if}{\quad if@> return; - } else if (mp_link(q) == p) { - mp_type(q) = l; + } else if (q->link == p) { + q->type = l; return; } else { - q = mp_link(q); + q = q->link; } } } @@ -18663,7 +18657,7 @@ void mp_resume_iteration (MP mp) p = mp->loop_ptr->list; if (p != NULL && p == mp->loop_ptr->list_start) { q = p; - p = mp_link(p); + p = p->link; mp_free_symbolic_node(mp, q); mp->loop_ptr->list = p; } @@ -18671,7 +18665,7 @@ void mp_resume_iteration (MP mp) mp_stop_iteration(mp); return; } - mp->loop_ptr->list = mp_link(p); + mp->loop_ptr->list = p->link; q = (mp_node) mp_get_sym_sym(p); if (q) { number_clone(mp->loop_ptr->old_value, q->data.n); @@ -18697,7 +18691,7 @@ void mp_resume_iteration (MP mp) mp_begin_diagnostic(mp); mp_print_nl(mp, "{loop value="); @.loop value=n@> -if ((q != NULL) && (mp_link(q) == MP_VOID)) { +if ((q != NULL) && (q->link == MP_VOID)) { mp_print_exp(mp, q, 1); } else { mp_show_token_list(mp, q, NULL); @@ -18710,7 +18704,7 @@ q = mp->loop_ptr->list; if (q == NULL) { goto NOT_FOUND; } else if (! mp_is_start_or_stop(q)) { - q = mp_link(q); + q = q->link; } else if (! mp_is_stop(q)) { q = mp_skip_1component(mp, q); } else { @@ -18740,7 +18734,7 @@ void mp_stop_iteration (MP mp) while (q != NULL) { p = (mp_node) mp_get_sym_sym(q); if (p != NULL) { - if (mp_link(p) == MP_VOID) { + if (p->link == MP_VOID) { /* it's an |expr| parameter */ mp_recycle_value(mp, p); mp_free_value_node(mp, p); @@ -18750,7 +18744,7 @@ void mp_stop_iteration (MP mp) } } p = q; - q = mp_link(q); + q = q->link; mp_free_symbolic_node(mp, p); } } else if (p > MP_PROGRESSION_FLAG) { @@ -18793,13 +18787,13 @@ do { } mp_set_cur_exp_node(mp, mp_stash_cur_exp(mp)); } - mp_link(q) = mp_new_symbolic_node(mp); - q = mp_link(q); + q->link = mp_new_symbolic_node(mp); + q = q->link; mp_set_sym_sym(q, mp->cur_exp.data.node); if (m == mp_start_for_code) { - mp_name_type(q) = mp_expr_operation; + q->name_type = mp_expr_operation; } else if (m == mp_start_forsuffixes_code) { - mp_name_type(q) = mp_suffix_operation; + q->name_type = mp_suffix_operation; } mp->cur_exp.type = mp_vacuous_type; CONTINUE: @@ -18875,9 +18869,9 @@ if (mp->cur_exp.type == mp_path_type) { @<Make sure the current expression is a known picture@> s->type = mp->cur_exp.data.node; mp->cur_exp.type = mp_vacuous_type; - q = mp_link(mp_edge_list(mp->cur_exp.data.node)); + q = mp_edge_list(mp->cur_exp.data.node)->link; if (q != NULL && mp_is_start_or_stop (q) && mp_skip_1component(mp, q) == NULL) { - q = mp_link(q); + q = q->link; } s->list = q; } @@ -19508,8 +19502,8 @@ static mp_node mp_stash_cur_exp (MP mp) break; default: /* |case mp_path_type: case mp_pen_type: case mp_string_type:| */ p = mp_new_value_node(mp); - mp_name_type(p) = mp_capsule_operation; - mp_type(p) = mp->cur_exp.type; + p->name_type = mp_capsule_operation; + p->type = mp->cur_exp.type; mp_set_value_number(p, cur_exp_value_number); /* this also resets the rest to 0/NULL */ if (cur_exp_str) { mp_set_value_str(p, cur_exp_str); @@ -19521,7 +19515,7 @@ static mp_node mp_stash_cur_exp (MP mp) break; } mp->cur_exp.type = mp_vacuous_type; - mp_link(p) = MP_VOID; + p->link = MP_VOID; return p; } @@ -19547,7 +19541,7 @@ resuscitates them. @ @c void mp_unstash_cur_exp (MP mp, mp_node p) { - mp->cur_exp.type = mp_type(p); + mp->cur_exp.type = p->type; switch (mp->cur_exp.type) { case mp_unknown_boolean_type: case mp_unknown_string_type: @@ -19629,7 +19623,7 @@ void mp_print_exp (MP mp, mp_node p, int verbosity) p = mp_stash_cur_exp(mp); restore_cur_exp = 1; } - t = mp_type(p); + t = p->type; if (t < mp_dependent_type) { /* no dep list, could be a capsule */ if (t != mp_vacuous_type && t != mp_known_type && mp_get_value_node(p) != NULL) { @@ -19649,7 +19643,7 @@ void mp_print_exp (MP mp, mp_node p, int verbosity) void mp_print_big_node (MP mp, mp_node v, int verbosity) { - switch (mp_type(v)) { + switch (v->type) { case mp_known_type: print_number(mp_get_value_number(v)); break; @@ -19657,7 +19651,7 @@ void mp_print_big_node (MP mp, mp_node v, int verbosity) mp_print_variable_name(mp, v); break; default: - mp_print_dp(mp, mp_type(v), (mp_value_node) mp_get_dep_list((mp_value_node) v), verbosity); + mp_print_dp(mp, v->type, (mp_value_node) mp_get_dep_list((mp_value_node) v), verbosity); break; } } @@ -19816,7 +19810,7 @@ if (verbosity <= 1) { @ @c static void mp_print_dp (MP mp, int t, mp_value_node p, int verbosity) { - mp_value_node q = (mp_value_node) mp_link(p); /* the node following |p| */ + mp_value_node q = (mp_value_node) p->link; /* the node following |p| */ if ((mp_get_dep_info(q) == NULL) || (verbosity > 0)) { mp_print_dependency(mp, p, t); } else { @@ -19832,7 +19826,7 @@ the ring consists entirely of capsules. mp_print_type(mp, t); if (v != NULL) { mp_print_chr(mp, ' '); - while ((mp_name_type(v) == mp_capsule_operation) && (v != p)) { + while ((v->name_type == mp_capsule_operation) && (v != p)) { v = mp_get_value_node(v); } mp_print_variable_name(mp, v); @@ -19914,7 +19908,7 @@ static void mp_recycle_value (MP mp, mp_node p); static void mp_recycle_value (MP mp, mp_node p) { if (p != NULL && p != MP_VOID) { - mp_variable_type t = mp_type(p); + mp_variable_type t = p->type; switch (t) { case mp_vacuous_type: case mp_boolean_type: @@ -19996,10 +19990,10 @@ static void mp_recycle_value (MP mp, mp_node p) { mp_value_node qq = (mp_value_node) mp_get_dep_list((mp_value_node) p); while (mp_get_dep_info(qq) != NULL) { - qq = (mp_value_node) mp_link(qq); + qq = (mp_value_node) qq->link; } - mp_set_link(mp_get_prev_dep((mp_value_node) p), mp_link(qq)); - mp_set_prev_dep(mp_link(qq), mp_get_prev_dep((mp_value_node) p)); + mp_set_link(mp_get_prev_dep((mp_value_node) p), qq->link); + mp_set_prev_dep(qq->link, mp_get_prev_dep((mp_value_node) p)); mp_set_link(qq, NULL); mp_flush_node_list(mp, (mp_node) mp_get_dep_list((mp_value_node) p)); } @@ -20018,7 +20012,7 @@ static void mp_recycle_value (MP mp, mp_node p) default: break; } - mp_type(p) = mp_undefined_type; + p->type = mp_undefined_type; } } @@ -20056,7 +20050,7 @@ static void mp_recycle_independent_value (MP mp, mp_node p) mp_node pp; /* link manipulation register */ mp_number v ; /* a value */ mp_number test; /* a temporary value */ - mp_variable_type t = mp_type(p); + mp_variable_type t = p->type; new_number(test); new_number(v); if (t < mp_dependent_type) { @@ -20066,23 +20060,23 @@ static void mp_recycle_independent_value (MP mp, mp_node p) set_number_to_zero(mp->max_c[mp_proto_dependent_type]); mp->max_link[mp_dependent_type] = NULL; mp->max_link[mp_proto_dependent_type] = NULL; - q = (mp_value_node) mp_link(mp->dep_head); + q = (mp_value_node) mp->dep_head->link; while (q != mp->dep_head) { s = (mp_value_node) mp->temp_head; mp_set_link(s, mp_get_dep_list(q)); while (1) { - r = (mp_value_node) mp_link(s); + r = (mp_value_node) s->link; if (mp_get_dep_info(r) == NULL) { break; } else if (mp_get_dep_info(r) != p) { s = r; } else { - t = mp_type(q); - if (mp_link(s) == mp_get_dep_list(q)) { + t = q->type; + if (s->link == mp_get_dep_list(q)) { /* reset the |dep_list| */ - mp_set_dep_list(q, mp_link(r)); + mp_set_dep_list(q, r->link); } - mp_set_link(s, mp_link(r)); + mp_set_link(s, r->link); mp_set_dep_info(r, (mp_node) q); number_abs_clone(test, mp_get_dep_value(r)); if (number_greater(test, mp->max_c[t])) { @@ -20099,7 +20093,7 @@ static void mp_recycle_independent_value (MP mp, mp_node p) } } } - q = (mp_value_node) mp_link(r); + q = (mp_value_node) r->link; } if (number_positive(mp->max_c[mp_dependent_type]) || number_positive(mp->max_c[mp_proto_dependent_type])) { /* @@ -20140,9 +20134,9 @@ static void mp_recycle_independent_value (MP mp, mp_node p) r = (mp_value_node) mp_get_dep_list((mp_value_node) pp); mp_set_link(s, r); while (mp_get_dep_info(r) != NULL) { - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; } - q = (mp_value_node) mp_link(r); + q = (mp_value_node) r->link; mp_set_link(r, NULL); mp_set_prev_dep(q, mp_get_prev_dep((mp_value_node) pp)); mp_set_link(mp_get_prev_dep((mp_value_node) pp), (mp_node) q); @@ -20180,7 +20174,7 @@ static void mp_recycle_independent_value (MP mp, mp_node p) mp_make_known(mp, q, mp->dep_final); } q = r; - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; mp_free_dep_node(mp, q); } } @@ -20196,7 +20190,7 @@ static void mp_recycle_independent_value (MP mp, mp_node p) mp->cur_exp.type = mp_proto_dependent_type; } mp_set_dep_list(q, mp_p_over_v(mp, (mp_value_node) mp_get_dep_list(q), &unity_t, mp_dependent_type, mp_proto_dependent_type)); - mp_type(q) = mp_proto_dependent_type; + q->type = mp_proto_dependent_type; fraction_to_round_scaled(mp_get_dep_value(r)); } number_negated_clone(test, v); @@ -20206,7 +20200,7 @@ static void mp_recycle_independent_value (MP mp, mp_node p) mp_make_known(mp, q, mp->dep_final); } q = r; - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; mp_free_dep_node(mp, q); } } @@ -20360,7 +20354,7 @@ void mp_scan_primary (MP mp) mp_node q = mp_new_value_node(mp); mp_node p1 = mp_stash_cur_exp(mp); mp_node r; /* temporary node */ - mp_name_type(q) = mp_capsule_operation; + q->name_type = mp_capsule_operation; mp_get_x_next(mp); mp_scan_expression(mp); /* Make sure the second part of a pair or color has a numeric type */ @@ -20449,7 +20443,7 @@ void mp_scan_primary (MP mp) } } mp_check_delimiter(mp, l_delim, r_delim); - mp->cur_exp.type = mp_type(q); + mp->cur_exp.type = q->type; mp_set_cur_exp_node(mp, q); } else { mp_check_delimiter(mp, l_delim, r_delim); @@ -20655,7 +20649,7 @@ void mp_scan_primary (MP mp) if (cur_cmd == mp_assignment_command) { mp_set_cur_exp_node(mp, mp_new_symbolic_node(mp)); mp_set_sym_info(cur_exp_node, qq); - mp_name_type(cur_exp_node) = mp_internal_operation; + cur_exp_node->name_type = mp_internal_operation; mp->cur_exp.type = mp_token_list_type; goto DONE; } @@ -20779,7 +20773,7 @@ within a \quote {big node.} @c static void mp_stash_in (MP mp, mp_node p) { - mp_type(p) = mp->cur_exp.type; + p->type = mp->cur_exp.type; if (mp->cur_exp.type == mp_known_type) { mp_set_value_number(p, cur_exp_value_number); } else if (mp->cur_exp.type == mp_independent_type) { @@ -20791,7 +20785,7 @@ static void mp_stash_in (MP mp, mp_node p) */ mp_value_node q = mp_single_dependency(mp, cur_exp_node); if (q == mp->dep_final) { - mp_type(p) = mp_known_type; + p->type = mp_known_type; mp_set_value_number(p, zero_t); mp_free_dep_node(mp, q); } else { @@ -20838,7 +20832,7 @@ the precise value of |tt| isn't critical. mp_node post_head = NULL; while (1) { t = mp_cur_tok(mp); - mp_link(tail) = t; + tail->link = t; if (tt != mp_undefined_type) { /* Find the approximate type |tt| and corresponding~|q|. Every time we call @@ -20847,7 +20841,7 @@ the precise value of |tt| isn't critical. variable structure; we need to start searching from the root each time. */ mp_sym qq; - p = mp_link(pre_head); + p = pre_head->link; qq = mp_get_sym_sym(p); tt = mp_undefined_type; // if (eq_type(qq) % mp_outer_tag_command == mp_tag_command) { @@ -20857,19 +20851,19 @@ the precise value of |tt| isn't critical. goto DONE2; } while (1) { - p = mp_link(p); + p = p->link; if (p == NULL) { - tt = mp_type(q); + tt = q->type; goto DONE2; } - if (mp_type(q) != mp_structured_type) { + if (q->type != mp_structured_type) { goto DONE2; } - q = mp_link(mp_get_attribute_head(q)); /* the |mp_collective_subscript| attribute */ - if (mp_type(p) == mp_symbol_node_type) { + q = mp_get_attribute_head(q)->link; /* the |mp_collective_subscript| attribute */ + if (p->type == mp_symbol_node_type) { /* it's not a subscript */ do { - q = mp_link(q); + q = q->link; } while (! (mp_get_hashloc(q) >= mp_get_sym_sym(p))); if (mp_get_hashloc(q) > mp_get_sym_sym(p)) { goto DONE2; @@ -20880,12 +20874,12 @@ the precise value of |tt| isn't critical. DONE2: if (tt >= mp_unsuffixed_macro_type) { /* Either begin an unsuffixed macro call or prepare for a suffixed one */ - mp_link(tail) = NULL; + tail->link = NULL; if (tt > mp_unsuffixed_macro_type) { /* |tt=mp_suffixed_macro| */ post_head = mp_new_symbolic_node(mp); tail = post_head; - mp_link(tail) = t; + tail->link = t; tt = mp_undefined_type; macro_ref = mp_get_value_node(q); mp_add_mac_ref(macro_ref); @@ -20897,8 +20891,8 @@ the precise value of |tt| isn't critical. appropriate list of lists. */ p = mp_new_symbolic_node(mp); - mp_set_sym_sym(pre_head, mp_link(pre_head)); - mp_link(pre_head) = p; + mp_set_sym_sym(pre_head, pre_head->link); + pre_head->link = p; mp_set_sym_sym(p, t); mp_macro_call(mp, mp_get_value_node(q), pre_head, NULL); mp_get_x_next(mp); @@ -20958,19 +20952,19 @@ the precise value of |tt| isn't critical. */ mp_back_input(mp); p = mp_new_symbolic_node(mp); - q = mp_link(post_head); - mp_set_sym_sym(pre_head, mp_link(pre_head)); - mp_link(pre_head) = post_head; + q = post_head->link; + mp_set_sym_sym(pre_head, pre_head->link); + pre_head->link = post_head; mp_set_sym_sym(post_head, q); - mp_link(post_head) = p; - mp_set_sym_sym(p, mp_link(q)); - mp_link(q) = NULL; + post_head->link = p; + mp_set_sym_sym(p, q->link); + q->link = NULL; mp_macro_call(mp, macro_ref, pre_head, NULL); mp_decr_mac_ref(macro_ref); mp_get_x_next(mp); goto RESTART; } - q = mp_link(pre_head); + q = pre_head->link; mp_free_symbolic_node(mp, pre_head); if (cur_cmd == my_var_flag) { mp->cur_exp.type = mp_token_list_type; @@ -21006,7 +21000,7 @@ the precise value of |tt| isn't critical. static void mp_back_expr (MP mp) { mp_node p = mp_stash_cur_exp(mp); /* capsule token */ - mp_link(p) = NULL; + p->link = NULL; mp_begin_token_list(mp, p, mp_backed_up_text); } @@ -21071,7 +21065,7 @@ multiplicity of possible cases. static void mp_make_exp_copy (MP mp, mp_node p) { RESTART: - mp->cur_exp.type = mp_type(p); + mp->cur_exp.type = p->type; switch (mp->cur_exp.type) { case mp_vacuous_type: case mp_boolean_type: @@ -21117,7 +21111,7 @@ static void mp_make_exp_copy (MP mp, mp_node p) mp_node t; mp_value_node q; if (mp_get_value_node(p) == NULL) { - switch (mp_type(p)) { + switch (p->type) { case mp_pair_type: mp_init_pair_node(mp, p); break; @@ -21135,7 +21129,7 @@ static void mp_make_exp_copy (MP mp, mp_node p) } } t = mp_new_value_node(mp); - mp_name_type(t) = mp_capsule_operation; + t->name_type = mp_capsule_operation; q = (mp_value_node) mp_get_value_node(p); switch (mp->cur_exp.type) { case mp_pair_type: @@ -21208,7 +21202,7 @@ list~|p|. static void mp_encapsulate (MP mp, mp_value_node p) { mp_node q = mp_new_value_node(mp); - mp_name_type(q) = mp_capsule_operation; + q->name_type = mp_capsule_operation; mp_new_dep(mp, q, mp->cur_exp.type, p); mp_set_cur_exp_node(mp, q); } @@ -21219,20 +21213,20 @@ a big node that will be part of a capsule. @<Declare subroutines needed by |make_exp_copy|@>= static void mp_install (MP mp, mp_node r, mp_node q) { - if (mp_type(q) == mp_known_type) { - mp_type(r) = mp_known_type; + if (q->type == mp_known_type) { + r->type = mp_known_type; mp_set_value_number(r, mp_get_value_number(q)); - } else if (mp_type(q) == mp_independent_type) { + } else if (q->type == mp_independent_type) { mp_value_node p = mp_single_dependency(mp, q); if (p == mp->dep_final) { - mp_type(r) = mp_known_type; + r->type = mp_known_type; mp_set_value_number(r, zero_t); mp_free_dep_node(mp, p); } else { mp_new_dep(mp, r, mp_dependent_type, p); } } else { - mp_new_dep(mp, r, mp_type(q), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list((mp_value_node) q))); + mp_new_dep(mp, r, q->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list((mp_value_node) q))); } } @@ -21272,15 +21266,15 @@ static void mp_scan_suffix (MP mp) } else if ((cur_cmd == mp_tag_command) || (cur_cmd == mp_internal_command)) { p = mp_new_symbolic_node(mp); mp_set_sym_sym(p, cur_sym); - mp_name_type(p) = cur_sym_mod; + p->name_type = cur_sym_mod; } else { break; } - mp_link(t) = p; + t->link = p; t = p; mp_get_x_next(mp); } - mp_set_cur_exp_node(mp, mp_link(h)); + mp_set_cur_exp_node(mp, h->link); mp_free_symbolic_node(mp, h); mp->cur_exp.type = mp_token_list_type; } @@ -21340,7 +21334,7 @@ static void mp_binary_mac (MP mp, mp_node p, mp_node c, mp_sym n) { mp_node q = mp_new_symbolic_node(mp); mp_node r = mp_new_symbolic_node(mp); - mp_link(q) = r; + q->link = r; mp_set_sym_sym(q, p); mp_set_sym_sym(r, mp_stash_cur_exp(mp)); mp_macro_call(mp, c, q, n); @@ -21417,7 +21411,7 @@ static void mp_scan_expression (MP mp) mac_name = cur_sym; mp_add_mac_ref(cc); } - if ((d < mp_ampersand_command) || ((d == mp_ampersand_command) && ((mp_type(p) == mp_pair_type) || (mp_type(p) == mp_path_type)))) { + if ((d < mp_ampersand_command) || ((d == mp_ampersand_command) && ((p->type == mp_pair_type) || (p->type == mp_path_type)))) { /* Scan a path construction operation; but |return| if |p| has the wrong type */ mp_unstash_cur_exp(mp, p); if (! mp_scan_path(mp)) { @@ -21837,7 +21831,7 @@ void mp_known_pair (MP mp) Make sure that both |x| and |y| parts of |p| are known; copy them into |cur_x| and |cur_y| */ - if (mp_type(mp_x_part(p)) == mp_known_type) { + if (mp_x_part(p)->type == mp_known_type) { number_clone(mp->cur_x, mp_get_value_number(mp_x_part(p))); } else { mp_disp_err(mp, mp_x_part(p)); @@ -21851,7 +21845,7 @@ void mp_known_pair (MP mp) mp_recycle_value(mp, mp_x_part(p)); set_number_to_zero(mp->cur_x); } - if (mp_type(mp_y_part(p)) == mp_known_type) { + if (mp_y_part(p)->type == mp_known_type) { number_clone(mp->cur_y, mp_get_value_number(mp_y_part(p))); } else { mp_disp_err(mp, mp_y_part(p)); @@ -22417,18 +22411,18 @@ color part primitives (this is needed for backward compatibility) . @c static int mp_pict_color_type (MP mp, int c) { - /* cur_pic_item = mp_link(mp_edge_list(cur_exp_node)) */ + /* cur_pic_item = mp_edge_list(cur_exp_node)->link */ return ( - (mp_link(mp_edge_list(cur_exp_node)) != NULL) + (mp_edge_list(cur_exp_node)->link != NULL) && ( - (! mp_has_color(mp_link(mp_edge_list(cur_exp_node)))) + (! mp_has_color(mp_edge_list(cur_exp_node)->link)) || (( - (mp_color_model(mp_link(mp_edge_list(cur_exp_node))) == c) + (mp_color_model(mp_edge_list(cur_exp_node)->link) == c) || ( - (mp_color_model(mp_link(mp_edge_list(cur_exp_node))) == mp_uninitialized_model) + (mp_color_model(mp_edge_list(cur_exp_node)->link) == mp_uninitialized_model) && (number_to_scaled(internal_value(mp_default_color_model_internal))/number_to_scaled(unity_t)) == c ) @@ -22946,12 +22940,12 @@ static void mp_do_unary (MP mp, int c) new_number(expr.data.n); if (mp->cur_exp.type != mp_picture_type) { set_number_from_boolean(expr.data.n, mp_false_operation); - } else if (mp_link(mp_edge_list(cur_exp_node)) == NULL) { + } else if (mp_edge_list(cur_exp_node)->link == NULL) { set_number_from_boolean(expr.data.n, mp_false_operation); } else { /* they are parallel: */ int type = c - mp_filled_operation + mp_fill_node_type; - set_number_from_boolean(expr.data.n, mp_type(mp_link(mp_edge_list(cur_exp_node))) == type ? mp_true_operation: mp_false_operation); + set_number_from_boolean(expr.data.n, mp_edge_list(cur_exp_node)->link->type == type ? mp_true_operation: mp_false_operation); } mp_flush_cur_exp(mp, expr); mp->cur_exp.type = mp_boolean_type; @@ -23186,7 +23180,7 @@ static int mp_nice_pair (MP mp, mp_node p, int t) (void) mp; if (t == mp_pair_type) { p = mp_get_value_node(p); - if (mp_type(mp_x_part(p)) == mp_known_type && mp_type(mp_y_part(p)) == mp_known_type) + if (mp_x_part(p)->type == mp_known_type && mp_y_part(p)->type == mp_known_type) return 1; } return 0; @@ -23203,23 +23197,25 @@ static int mp_nice_color_or_pair (MP mp, mp_node p, int t) switch (t) { case mp_pair_type: q = mp_get_value_node(p); - if (mp_type(mp_x_part(q)) == mp_known_type - && mp_type(mp_y_part(q)) == mp_known_type) + if (mp_x_part(q)->type == mp_known_type + && mp_y_part(q)->type == mp_known_type) { return 1; - break; + } else { + break; + } case mp_color_type: q = mp_get_value_node(p); - if (mp_type(mp_red_part (q)) == mp_known_type - && mp_type(mp_green_part(q)) == mp_known_type - && mp_type(mp_blue_part (q)) == mp_known_type) + if (mp_red_part (q)->type == mp_known_type + && mp_green_part(q)->type == mp_known_type + && mp_blue_part (q)->type == mp_known_type) return 1; break; case mp_cmykcolor_type: q = mp_get_value_node(p); - if (mp_type(mp_cyan_part (q)) == mp_known_type - && mp_type(mp_magenta_part(q)) == mp_known_type - && mp_type(mp_yellow_part (q)) == mp_known_type - && mp_type(mp_black_part (q)) == mp_known_type) + if (mp_cyan_part (q)->type == mp_known_type + && mp_magenta_part(q)->type == mp_known_type + && mp_yellow_part (q)->type == mp_known_type + && mp_black_part (q)->type == mp_known_type) return 1; break; } @@ -23283,7 +23279,7 @@ static void mp_negate_dep_list (MP mp, mp_value_node p) number_negate(mp_get_dep_value(p)); if (mp_get_dep_info(p) == NULL) return; - p = (mp_value_node) mp_link(p); + p = (mp_value_node) p->link; } } @@ -23300,7 +23296,7 @@ recycling it afterwards (cf.~the |stash_in| routine). static void mp_negate_value(MP mp, mp_node r) { - if (mp_type(r) == mp_known_type) { + if (r->type == mp_known_type) { mp_set_value_number(r, mp_get_value_number(r)); /* to clear the rest */ number_negate(mp_get_value_number(r)); } else { @@ -23386,7 +23382,7 @@ static void mp_bad_color_part (MP mp, int c) mp_string sname; memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); - p = mp_link(mp_edge_list(cur_exp_node)); + p = mp_edge_list(cur_exp_node)->link; mp_disp_err(mp, NULL); selector = mp->selector; mp->selector = mp_new_string_selector; @@ -23425,8 +23421,8 @@ static void mp_take_part (MP mp, int c) { mp_node p = mp_get_value_node(cur_exp_node); /* the big node */ mp_set_value_node(mp->temp_val, p); - mp_type(mp->temp_val) = mp->cur_exp.type; - mp_link(p) = mp->temp_val; + mp->temp_val->type = mp->cur_exp.type; + p->link= mp->temp_val; mp_free_value_node(mp, cur_exp_node); switch (c) { case mp_x_part_operation: @@ -23485,7 +23481,7 @@ static void mp_take_part (MP mp, int c) @ @<Initialize table entries@>= mp->temp_val = mp_new_value_node(mp); -mp_name_type(mp->temp_val) = mp_capsule_operation; +mp->temp_val->name_type = mp_capsule_operation; @ @<Free table entries@>= mp_free_value_node(mp, mp->temp_val); @@ -23500,7 +23496,7 @@ static void mp_take_pict_part (MP mp, int c) mp_value new_expr; memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); - p = mp_link(mp_edge_list(cur_exp_node)); + p = mp_edge_list(cur_exp_node)->link; if (p != NULL) { switch (c) { case mp_x_part_operation: @@ -23614,7 +23610,7 @@ static void mp_take_pict_part (MP mp, int c) mp_confusion(mp, "picture"); } else { new_expr.data.node = NULL; - switch (mp_type(p)) { + switch (p->type) { case mp_fill_node_type: case mp_stroked_node_type: new_expr.data.p = mp_copy_path(mp, mp_path_ptr((mp_shape_node) p)); @@ -23635,7 +23631,7 @@ static void mp_take_pict_part (MP mp, int c) if (! mp_has_pen(p)) { goto NOT_FOUND; } else { - switch (mp_type(p)) { + switch (p->type) { case mp_fill_node_type: case mp_stroked_node_type: if (mp_pen_ptr((mp_shape_node) p) == NULL) { @@ -23652,7 +23648,7 @@ static void mp_take_pict_part (MP mp, int c) } break; case mp_dash_part_operation: - if (mp_type(p) != mp_stroked_node_type) { + if (p->type != mp_stroked_node_type) { goto NOT_FOUND; } else if (mp_dash_ptr(p) == NULL) { goto NOT_FOUND; @@ -23754,15 +23750,15 @@ static void mp_path_length (MP mp, mp_number *n) static void mp_picture_length (MP mp, mp_number *n) { /* counts interior components in picture |cur_exp| */ - mp_node p = mp_link(mp_edge_list(cur_exp_node)); + mp_node p = mp_edge_list(cur_exp_node)->link; int l = 0; if (p != NULL) { if (mp_is_start_or_stop(p) && mp_skip_1component(mp, p) == NULL) { - p = mp_link(p); + p = p->link; } while (p != NULL) { if (! mp_is_start_or_stop(p)) { - p = mp_link(p); + p = p->link; } else if (! mp_is_stop(p)) { p = mp_skip_1component(mp, p); } else { @@ -23915,13 +23911,13 @@ static void mp_bezier_slope (MP mp, static void mp_turn_cycles (MP mp, mp_number *turns, mp_knot c) { int selector; /* saved |selector| setting */ - mp_angle res, ang; /* the angles of intermediate results */ + mp_number res, ang; /* the angles of intermediate results */ mp_knot p; /* for running around the path */ mp_number xp, yp; /* coordinates of next point */ mp_number x, y; /* helper coordinates */ mp_number arg1, arg2; - mp_angle in_angle, out_angle; /* helper angles */ - mp_angle seven_twenty_deg_t; + mp_number in_angle, out_angle; /* helper angles */ + mp_number seven_twenty_deg_t; set_number_to_zero(*turns); new_number(arg1); new_number(arg2); @@ -24050,12 +24046,12 @@ static int mp_test_known (MP mp, int c) case mp_transform_type: { mp_node p = mp_get_value_node(cur_exp_node); - if ( (mp_type(mp_tx_part(p)) == mp_known_type) && - (mp_type(mp_ty_part(p)) == mp_known_type) && - (mp_type(mp_xx_part(p)) == mp_known_type) && - (mp_type(mp_xy_part(p)) == mp_known_type) && - (mp_type(mp_yx_part(p)) == mp_known_type) && - (mp_type(mp_yy_part(p)) == mp_known_type) ) { + if ( (mp_tx_part(p)->type == mp_known_type) && + (mp_ty_part(p)->type == mp_known_type) && + (mp_xx_part(p)->type == mp_known_type) && + (mp_xy_part(p)->type== mp_known_type) && + (mp_yx_part(p)->type == mp_known_type) && + (mp_yy_part(p)->type == mp_known_type) ) { b = mp_true_operation; } } @@ -24063,9 +24059,9 @@ static int mp_test_known (MP mp, int c) case mp_color_type: { mp_node p = mp_get_value_node(cur_exp_node); - if ( (mp_type(mp_red_part(p)) == mp_known_type) && - (mp_type(mp_green_part(p)) == mp_known_type) && - (mp_type(mp_blue_part(p)) == mp_known_type) ) { + if ( (mp_red_part (p)->type == mp_known_type) && + (mp_green_part(p)->type == mp_known_type) && + (mp_blue_part (p)->type == mp_known_type) ) { b = mp_true_operation; } } @@ -24073,10 +24069,10 @@ static int mp_test_known (MP mp, int c) case mp_cmykcolor_type: { mp_node p = mp_get_value_node(cur_exp_node); - if ( (mp_type(mp_cyan_part(p)) == mp_known_type) && - (mp_type(mp_magenta_part(p)) == mp_known_type) && - (mp_type(mp_yellow_part(p)) == mp_known_type) && - (mp_type(mp_black_part(p)) == mp_known_type) ) { + if ( (mp_cyan_part (p)->type == mp_known_type) && + (mp_magenta_part(p)->type == mp_known_type) && + (mp_yellow_part (p)->type == mp_known_type) && + (mp_black_part (p)->type == mp_known_type) ) { b = mp_true_operation; } } @@ -24084,8 +24080,8 @@ static int mp_test_known (MP mp, int c) case mp_pair_type: { mp_node p = mp_get_value_node(cur_exp_node); - if ( (mp_type(mp_x_part(p)) == mp_known_type) && - (mp_type(mp_y_part(p)) == mp_known_type) ) { + if ( (mp_x_part(p)->type == mp_known_type) && + (mp_y_part(p)->type == mp_known_type) ) { b = mp_true_operation; } } @@ -24117,16 +24113,16 @@ static void mp_pair_value (MP mp, mp_number *x, mp_number *y) memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); p = mp_new_value_node(mp); - new_expr.type = mp_type(p); + new_expr.type = p->type; new_expr.data.node = p; mp_flush_cur_exp(mp, new_expr); mp->cur_exp.type = mp_pair_type; - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp_init_pair_node(mp, p); p = mp_get_value_node(p); - mp_type(mp_x_part(p)) = mp_known_type; + mp_x_part(p)->type = mp_known_type; mp_set_value_number(mp_x_part(p), x1); - mp_type(mp_y_part(p)) = mp_known_type; + mp_y_part(p)->type = mp_known_type; mp_set_value_number(mp_y_part(p), y1); free_number(x1); free_number(y1); @@ -24349,7 +24345,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) define a simple function called |tarnished| that returns |NULL| if and only if its argument is not tarnished. */ - switch (mp_type(p)) { + switch (p->type) { case mp_transform_type: case mp_color_type: case mp_cmykcolor_type: @@ -24393,19 +24389,19 @@ static void mp_do_binary (MP mp, mp_node p, int c) case mp_plus_operation: case mp_minus_operation: /* Add or subtract the current expression from |p| */ - if ((mp->cur_exp.type < mp_color_type) || (mp_type(p) < mp_color_type)) { + if ((mp->cur_exp.type < mp_color_type) || (p->type < mp_color_type)) { mp_bad_binary(mp, p, c); } else { - if ((mp->cur_exp.type > mp_pair_type) && (mp_type(p) > mp_pair_type)) { + if ((mp->cur_exp.type > mp_pair_type) && (p->type > mp_pair_type)) { mp_add_or_subtract(mp, p, NULL, c); - } else if (mp->cur_exp.type != mp_type(p)) { + } else if (mp->cur_exp.type != p->type) { /* We catch a mismatch, so we can handle intermediates (assuming a flexible withcolor); if we would go double only live would be easier ... I might eventually make a more generic color type. */ /* - if (mp->cur_exp.type == mp_color_type && mp_type(p) == mp_cmykcolor_type) { + if (mp->cur_exp.type == mp_color_type && p->type == mp_cmykcolor_type) { mp_node q = mp_get_value_node(p); mp_node r = mp_get_value_node(cur_exp_node); number_negate((mp_cyan_part(q))->data.n); @@ -24417,7 +24413,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) mp_add_or_subtract(mp, mp_cyan_part(q), mp_red_part(r), c); mp_add_or_subtract(mp, mp_magenta_part(q), mp_green_part(r), c); mp_add_or_subtract(mp, mp_yellow_part(q), mp_blue_part(r), c); - } else if (mp->cur_exp.type == mp_cmykcolor_type && mp_type(p) == mp_color_type) { + } else if (mp->cur_exp.type == mp_cmykcolor_type && p->type == mp_color_type) { mp_node q = mp_get_value_node(p); mp_node r = mp_get_value_node(cur_exp_node); number_negate((mp_red_part(q))->data.n); @@ -24474,10 +24470,10 @@ static void mp_do_binary (MP mp, mp_node p, int c) case mp_unequal_operation: check_arith(); /* at this point |arith_error| should be |false|? */ - if ((mp->cur_exp.type > mp_pair_type) && (mp_type(p) > mp_pair_type)) { + if ((mp->cur_exp.type > mp_pair_type) && (p->type > mp_pair_type)) { /* |cur_exp:=(p)-cur_exp| */ mp_add_or_subtract(mp, p, NULL, mp_minus_operation); - } else if (mp->cur_exp.type != mp_type(p)) { + } else if (mp->cur_exp.type != p->type) { mp_bad_binary(mp, p, (int) c); goto DONE; } else { @@ -24524,13 +24520,13 @@ static void mp_do_binary (MP mp, mp_node p, int c) mp_node rr = mp_x_part(r); part_type = mp_x_part_operation; mp_add_or_subtract(mp, mp_x_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_y_part(r); part_type = mp_y_part_operation; mp_add_or_subtract(mp, mp_y_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } } @@ -24546,19 +24542,19 @@ static void mp_do_binary (MP mp, mp_node p, int c) mp_node rr = mp_red_part(r); part_type = mp_red_part_operation; mp_add_or_subtract(mp, mp_red_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_green_part(r); part_type = mp_green_part_operation; mp_add_or_subtract(mp, mp_green_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_blue_part(r); part_type = mp_blue_part_operation; mp_add_or_subtract(mp, mp_blue_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } } @@ -24574,25 +24570,25 @@ static void mp_do_binary (MP mp, mp_node p, int c) mp_node rr = mp_cyan_part(r); part_type = mp_cyan_part_operation; mp_add_or_subtract(mp, mp_cyan_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_magenta_part(r); part_type = mp_magenta_part_operation; mp_add_or_subtract(mp, mp_magenta_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_yellow_part(r); part_type = mp_yellow_part_operation; mp_add_or_subtract(mp, mp_yellow_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_black_part(r); part_type = mp_black_part_operation; mp_add_or_subtract(mp, mp_black_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } } @@ -24608,37 +24604,37 @@ static void mp_do_binary (MP mp, mp_node p, int c) mp_node rr = mp_tx_part(r); part_type = mp_x_part_operation; mp_add_or_subtract(mp, mp_tx_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_ty_part(r); part_type = mp_y_part_operation; mp_add_or_subtract(mp, mp_ty_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_xx_part(r); part_type = mp_xx_part_operation; mp_add_or_subtract(mp, mp_xx_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_xy_part(r); part_type = mp_xy_part_operation; mp_add_or_subtract(mp, mp_xy_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_yx_part(r); part_type = mp_yx_part_operation; mp_add_or_subtract(mp, mp_yx_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } rr = mp_yy_part(r); part_type = mp_yy_part_operation; mp_add_or_subtract(mp, mp_yy_part(q), rr, mp_minus_operation); - if (mp_type(rr) != mp_known_type || ! number_zero(mp_get_value_number(rr))) { + if (rr->type != mp_known_type || ! number_zero(mp_get_value_number(rr))) { break; } } @@ -24710,20 +24706,20 @@ static void mp_do_binary (MP mp, mp_node p, int c) case mp_and_operation: case mp_or_operation: /* Here we use the sneaky fact that |and_op-false_code=or_op-true_code| */ - if ((mp_type(p) != mp_boolean_type) || (mp->cur_exp.type != mp_boolean_type)) { + if ((p->type != mp_boolean_type) || (mp->cur_exp.type != mp_boolean_type)) { mp_bad_binary(mp, p, (int) c); } else if (number_to_boolean(p->data.n) == c + mp_false_operation - mp_and_operation) { mp_set_cur_exp_value_boolean(mp, number_to_boolean(p->data.n)); } break; case mp_times_operation: - if ((mp->cur_exp.type < mp_color_type) || (mp_type(p) < mp_color_type)) { + if ((mp->cur_exp.type < mp_color_type) || (p->type < mp_color_type)) { mp_bad_binary(mp, p, mp_times_operation); - } else if ((mp->cur_exp.type == mp_known_type) || (mp_type(p) == mp_known_type)) { + } else if ((mp->cur_exp.type == mp_known_type) || (p->type == mp_known_type)) { /* Multiply when at least one operand is known */ mp_number vv; new_fraction(vv); - if (mp_type(p) == mp_known_type) { + if (p->type == mp_known_type) { number_clone(vv, mp_get_value_number(p)); mp_free_value_node(mp, p); } else { @@ -24770,8 +24766,8 @@ static void mp_do_binary (MP mp, mp_node p, int c) free_number(vv); mp_finish_binary(mp, old_p, old_exp); return; - } else if ((mp_nice_color_or_pair(mp, p, mp_type(p)) && (mp->cur_exp.type > mp_pair_type)) - || (mp_nice_color_or_pair(mp, cur_exp_node, mp->cur_exp.type) && (mp_type(p) > mp_pair_type))) { + } else if ((mp_nice_color_or_pair(mp, p, p->type) && (mp->cur_exp.type > mp_pair_type)) + || (mp_nice_color_or_pair(mp, cur_exp_node, mp->cur_exp.type) && (p->type > mp_pair_type))) { mp_hard_times(mp, p); mp_finish_binary(mp, old_p, old_exp); return; @@ -24780,7 +24776,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) } break; case mp_over_operation: - if ((mp->cur_exp.type != mp_known_type) || (mp_type(p) < mp_color_type)) { + if ((mp->cur_exp.type != mp_known_type) || (p->type < mp_color_type)) { mp_bad_binary(mp, p, mp_over_operation); } else { mp_number v_n; @@ -24841,7 +24837,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) } break; case mp_power_operation: - if ((mp->cur_exp.type == mp_known_type) && (mp_type(p) == mp_known_type)) { + if ((mp->cur_exp.type == mp_known_type) && (p->type == mp_known_type)) { mp_number r; new_number(r); power_of(r, mp_get_value_number(p), cur_exp_value_number); @@ -24853,7 +24849,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) break; case mp_pythag_add_operation: case mp_pythag_sub_operation: - if ((mp->cur_exp.type == mp_known_type) && (mp_type(p) == mp_known_type)) { + if ((mp->cur_exp.type == mp_known_type) && (p->type == mp_known_type)) { mp_number r; new_number(r); if (c == mp_pythag_add_operation) { @@ -24878,7 +24874,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) The next few sections of the program deal with affine transformations of coordinate data. */ - switch (mp_type(p)) { + switch (p->type) { case mp_path_type: mp_set_up_known_trans(mp, (int) c); mp_unstash_cur_exp(mp, p); @@ -24917,7 +24913,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) case mp_just_append_operation: case mp_tolerant_concat_operation: case mp_tolerant_append_operation: - if ((mp->cur_exp.type == mp_string_type) && (mp_type(p) == mp_string_type)) { + if ((mp->cur_exp.type == mp_string_type) && (p->type == mp_string_type)) { mp_string str = mp_cat(mp, mp_get_value_str(p), cur_exp_str); delete_str_ref(cur_exp_str) ; mp_set_cur_exp_str(mp, str); @@ -24926,7 +24922,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) } break; case mp_substring_operation: - if (mp_nice_pair(mp, p, mp_type(p)) && (mp->cur_exp.type == mp_string_type)) { + if (mp_nice_pair(mp, p, p->type) && (mp->cur_exp.type == mp_string_type)) { mp_string str = mp_chop_string (mp, cur_exp_str, round_unscaled(mp_get_value_number(mp_x_part(mp_get_value_node(p)))), @@ -24942,7 +24938,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if (mp_nice_pair(mp, p, mp_type(p)) && (mp->cur_exp.type == mp_path_type)) { + if (mp_nice_pair(mp, p, p->type) && (mp->cur_exp.type == mp_path_type)) { mp_chop_path(mp, mp_get_value_node(p)); } else { mp_bad_binary(mp, p, mp_subpath_operation); @@ -24955,14 +24951,14 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && (mp_type(p) == mp_known_type)) { + if ((mp->cur_exp.type == mp_path_type) && (p->type == mp_known_type)) { mp_find_point(mp, &(mp_get_value_number(p)), (int) c); } else { mp_bad_binary(mp, p, c); } break; case mp_pen_offset_operation: - if ((mp->cur_exp.type == mp_pen_type || mp->cur_exp.type == mp_nep_type) && mp_nice_pair(mp, p, mp_type(p))) { + if ((mp->cur_exp.type == mp_pen_type || mp->cur_exp.type == mp_nep_type) && mp_nice_pair(mp, p, p->type)) { mp_set_up_offset(mp, mp_get_value_node(p)); } else { mp_bad_binary(mp, p, mp_pen_offset_operation); @@ -24972,21 +24968,21 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && mp_nice_pair(mp, p, mp_type(p))) { + if ((mp->cur_exp.type == mp_path_type) && mp_nice_pair(mp, p, p->type)) { mp_set_up_direction_time(mp, mp_get_value_node(p)); } else { mp_bad_binary(mp, p, mp_direction_time_operation); } break; case mp_envelope_operation: - if ((mp_type(p) != mp_pen_type && mp_type(p) != mp_nep_type) || (mp->cur_exp.type != mp_path_type)) { + if ((p->type != mp_pen_type && p->type != mp_nep_type) || (mp->cur_exp.type != mp_path_type)) { mp_bad_binary(mp, p, mp_envelope_operation); } else { mp_set_up_envelope(mp, p); } break; case mp_boundingpath_operation: - if ((mp_type(p) != mp_pen_type && mp_type(p) != mp_nep_type) || (mp->cur_exp.type != mp_path_type)) { + if ((p->type != mp_pen_type && p->type != mp_nep_type) || (mp->cur_exp.type != mp_path_type)) { mp_bad_binary(mp, p, mp_boundingpath_operation); } else { mp_set_up_boundingpath(mp, p); @@ -24996,7 +24992,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && (mp_type(p) == mp_known_type)) { + if ((mp->cur_exp.type == mp_path_type) && (p->type == mp_known_type)) { memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); mp_get_arc_time(mp, &new_expr.data.n, cur_exp_knot, &(mp_get_value_number(p)), 0); @@ -25010,11 +25006,11 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && (mp_type(p) == mp_known_type || mp_type(p) == mp_pair_type)) { + if ((mp->cur_exp.type == mp_path_type) && (p->type == mp_known_type || p->type == mp_pair_type)) { mp_knot k; memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); - if (mp_type(p) == mp_pair_type) { + if (p->type == mp_pair_type) { mp_knot f = cur_exp_knot; mp_node q = mp_get_value_node(p); mp_number x; @@ -25083,7 +25079,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && mp_type(p) == mp_known_type) { + if ((mp->cur_exp.type == mp_path_type) && p->type == mp_known_type) { // we can consider using ints as we have discrete points mp_knot cur = cur_exp_knot; mp_number len, aln, seg, tot, tim, stp, acc, tmp; @@ -25184,7 +25180,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && mp_type(p) == mp_pair_type) { + if ((mp->cur_exp.type == mp_path_type) && p->type == mp_pair_type) { memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); mp_node q = mp_get_value_node(p); @@ -25196,7 +25192,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) break; case mp_intertimes_operation: case mp_intertimes_list_operation: - if (mp_type(p) == mp_pair_type) { + if (p->type == mp_pair_type) { mp_node q = mp_stash_cur_exp(mp); mp_unstash_cur_exp(mp, p); mp_pair_to_path(mp); @@ -25206,7 +25202,7 @@ static void mp_do_binary (MP mp, mp_node p, int c) if (mp->cur_exp.type == mp_pair_type) { mp_pair_to_path(mp); } - if ((mp->cur_exp.type == mp_path_type) && (mp_type(p) == mp_path_type)) { + if ((mp->cur_exp.type == mp_path_type) && (p->type == mp_path_type)) { if (c == mp_intertimes_operation) { // mp_number arg1, arg2; // mp_path_intersection(mp, mp_get_value_knot(p), cur_exp_knot, 0, NULL); @@ -25245,7 +25241,7 @@ static void mp_bad_binary (MP mp, mp_node p, int c) if (c >= mp_min_of_operation) { mp_print_op(mp, c); } - mp_print_known_or_unknown_type(mp, mp_type(p), p); + mp_print_known_or_unknown_type(mp, p->type, p); if (c >= mp_min_of_operation) { mp_print_str(mp, "of"); } else { @@ -25289,33 +25285,33 @@ static mp_node mp_tarnished (MP mp, mp_node p) { mp_node q = mp_get_value_node(p); (void) mp; - switch (mp_type(p)) { + switch (p->type) { case mp_pair_type: return ( - (mp_type(mp_x_part(q)) == mp_independent_type) || - (mp_type(mp_y_part(q)) == mp_independent_type) + (mp_x_part(q)->type == mp_independent_type) || + (mp_y_part(q)->type == mp_independent_type) ) ? MP_VOID : NULL; case mp_color_type: return ( - (mp_type(mp_red_part(q)) == mp_independent_type) || - (mp_type(mp_green_part(q)) == mp_independent_type) || - (mp_type(mp_blue_part(q)) == mp_independent_type) + (mp_red_part (q)->type == mp_independent_type) || + (mp_green_part(q)->type == mp_independent_type) || + (mp_blue_part (q)->type == mp_independent_type) ) ? MP_VOID : NULL; case mp_cmykcolor_type: return ( - (mp_type(mp_cyan_part(q)) == mp_independent_type) || - (mp_type(mp_magenta_part(q)) == mp_independent_type) || - (mp_type(mp_yellow_part(q)) == mp_independent_type) || - (mp_type(mp_black_part(q)) == mp_independent_type) + (mp_cyan_part (q)->type == mp_independent_type) || + (mp_magenta_part(q)->type == mp_independent_type) || + (mp_yellow_part (q)->type == mp_independent_type) || + (mp_black_part (q)->type == mp_independent_type) ) ? MP_VOID : NULL; case mp_transform_type: return ( - (mp_type(mp_tx_part(q)) == mp_independent_type) || - (mp_type(mp_ty_part(q)) == mp_independent_type) || - (mp_type(mp_xx_part(q)) == mp_independent_type) || - (mp_type(mp_xy_part(q)) == mp_independent_type) || - (mp_type(mp_yx_part(q)) == mp_independent_type) || - (mp_type(mp_yy_part(q)) == mp_independent_type) + (mp_tx_part(q)->type == mp_independent_type) || + (mp_ty_part(q)->type == mp_independent_type) || + (mp_xx_part(q)->type == mp_independent_type) || + (mp_xy_part(q)->type == mp_independent_type) || + (mp_yx_part(q)->type == mp_independent_type) || + (mp_yy_part(q)->type == mp_independent_type) ) ? MP_VOID : NULL; default: return NULL; @@ -25349,7 +25345,7 @@ static void mp_add_or_subtract (MP mp, mp_node p, mp_node q, int c) v = (mp_value_node) mp_get_dep_list((mp_value_node) cur_exp_node); } } else { - t = mp_type(q); + t = q->type; if (t < mp_dependent_type) { number_clone(vv, mp_get_value_number(q)); } else { @@ -25361,7 +25357,7 @@ static void mp_add_or_subtract (MP mp, mp_node p, mp_node q, int c) if (c == mp_minus_operation) { number_negate(vv); } - if (mp_type(p) == mp_known_type) { + if (p->type == mp_known_type) { slow_add(vv, mp_get_value_number(p), vv); if (q == NULL) { mp_set_cur_exp_value_number(mp, &vv); @@ -25374,22 +25370,22 @@ static void mp_add_or_subtract (MP mp, mp_node p, mp_node q, int c) /* Add a known value to the constant term of |mp_get_dep_list(p)| */ r = (mp_value_node) mp_get_dep_list((mp_value_node) p); while (mp_get_dep_info(r) != NULL) { - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; } slow_add(vv, mp_get_dep_value(r), vv); mp_set_dep_value(r, vv); if (qq == NULL) { qq = mp_get_dep_node(mp); mp_set_cur_exp_node(mp, (mp_node) qq); - mp->cur_exp.type = mp_type(p); - mp_name_type(qq) = mp_capsule_operation; + mp->cur_exp.type = p->type; + qq->name_type = mp_capsule_operation; /* clang: never read: |q = (mp_node) qq;| */ } mp_set_dep_list(qq, mp_get_dep_list((mp_value_node) p)); - mp_type(qq) = mp_type(p); + qq->type = p->type; mp_set_prev_dep(qq, mp_get_prev_dep((mp_value_node) p)); - mp_link(mp_get_prev_dep((mp_value_node) p)) = (mp_node) qq; - mp_type(p) = mp_known_type; /* this will keep the recycler from collecting non-garbage */ + mp_get_prev_dep((mp_value_node) p)->link = (mp_node) qq; + p->type = mp_known_type; /* this will keep the recycler from collecting non-garbage */ } } else { if (c == mp_minus_operation) { @@ -25401,15 +25397,15 @@ static void mp_add_or_subtract (MP mp, mp_node p, mp_node q, int c) of |fraction| coefficients. But we have to handle both kinds, and mixtures too. */ - if (mp_type(p) == mp_known_type) { + if (p->type == mp_known_type) { /* Add the known |value(p)| to the constant term of |v| */ while (mp_get_dep_info(v) != NULL) { - v = (mp_value_node) mp_link(v); + v = (mp_value_node) v->link; } slow_add(vv, mp_get_value_number(p), mp_get_dep_value(v)); mp_set_dep_value(v, vv); } else { - s = mp_type(p); + s = p->type; r = (mp_value_node) mp_get_dep_list((mp_value_node) p); if (t == mp_dependent_type) { if (s == mp_dependent_type) { @@ -25459,7 +25455,7 @@ static void mp_dep_finish (MP mp, mp_value_node v, mp_value_node q, int t) { mp_value_node p = (q == NULL) ? (mp_value_node) cur_exp_node : q; /* the destination */ mp_set_dep_list(p, v); - mp_type(p) = t; + p->type = t; if (mp_get_dep_info(v) == NULL) { mp_number vv; /* the value, if it is |known| */ new_number_clone(vv, mp_get_value_number(v)); @@ -25470,7 +25466,7 @@ static void mp_dep_finish (MP mp, mp_value_node v, mp_value_node q, int t) mp_flush_cur_exp(mp, new_expr); } else { mp_recycle_value(mp, (mp_node) p); - mp_type(q) = mp_known_type; + q->type = mp_known_type; mp_set_value_number(q, vv); } free_number(vv); @@ -25489,7 +25485,7 @@ static void mp_dep_mult (MP mp, mp_value_node p, mp_number *v, int v_is_scaled) int s, t; /* its type, before and after */ if (p == NULL) { q = (mp_value_node) cur_exp_node; - } else if (mp_type(p) != mp_known_type) { + } else if (p->type != mp_known_type) { q = p; } else { mp_number r1, arg1; @@ -25506,7 +25502,7 @@ static void mp_dep_mult (MP mp, mp_value_node p, mp_number *v, int v_is_scaled) free_number(arg1); return; } - t = mp_type(q); + t = q->type; q = (mp_value_node) mp_get_dep_list(q); s = t; if (t == mp_dependent_type && v_is_scaled) { @@ -25623,7 +25619,7 @@ static void mp_hard_times (MP mp, mp_node p) mp_value_node pp; /* for typecasting p */ mp_number v; /* the known value for |r| */ new_number(v); - if (mp_type(p) <= mp_pair_type) { + if (p->type <= mp_pair_type) { q = (mp_value_node) mp_stash_cur_exp(mp); mp_unstash_cur_exp(mp, p); p = (mp_node) q; @@ -25635,11 +25631,11 @@ static void mp_hard_times (MP mp, mp_node p) { mp_node r = mp_x_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_y_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); } break; @@ -25647,15 +25643,15 @@ static void mp_hard_times (MP mp, mp_node p) { mp_node r = mp_red_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_green_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_blue_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); } break; @@ -25663,19 +25659,19 @@ static void mp_hard_times (MP mp, mp_node p) { mp_node r = mp_cyan_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_yellow_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_magenta_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); r = mp_black_part(mp_get_value_node(cur_exp_node)); number_clone(v, mp_get_value_number(r)); - mp_new_dep(mp, r, mp_type(pp), mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); + mp_new_dep(mp, r, pp->type, mp_copy_dep_list(mp, (mp_value_node) mp_get_dep_list(pp))); mp_dep_mult(mp, (mp_value_node) r, &v, 1); } break; @@ -25692,7 +25688,7 @@ static void mp_dep_div (MP mp, mp_value_node p, mp_number *v) int s, t; /* its type, before and after */ if (p == NULL) { q = (mp_value_node) cur_exp_node; - } else if (mp_type(p) != mp_known_type) { + } else if (p->type != mp_known_type) { q = p; } else { mp_number ret; @@ -25702,7 +25698,7 @@ static void mp_dep_div (MP mp, mp_value_node p, mp_number *v) free_number(ret); return; } - t = mp_type(q); + t = q->type; q = (mp_value_node) mp_get_dep_list(q); s = t; if (t == mp_dependent_type) { @@ -25760,12 +25756,12 @@ static void mp_set_up_trans (MP mp, int c) otherwise |return| */ q = mp_get_value_node(cur_exp_node); - if ( (mp_type(mp_tx_part(q)) == mp_known_type) && - (mp_type(mp_ty_part(q)) == mp_known_type) && - (mp_type(mp_xx_part(q)) == mp_known_type) && - (mp_type(mp_xy_part(q)) == mp_known_type) && - (mp_type(mp_yx_part(q)) == mp_known_type) && - (mp_type(mp_yy_part(q)) == mp_known_type) ) { + if ( (mp_tx_part(q)->type == mp_known_type) && + (mp_ty_part(q)->type == mp_known_type) && + (mp_xx_part(q)->type == mp_known_type) && + (mp_xy_part(q)->type == mp_known_type) && + (mp_yx_part(q)->type == mp_known_type) && + (mp_yy_part(q)->type == mp_known_type) ) { number_clone(mp->txx, mp_get_value_number(mp_xx_part(q))); number_clone(mp->txy, mp_get_value_number(mp_xy_part(q))); number_clone(mp->tyx, mp_get_value_number(mp_yx_part(q))); @@ -25804,25 +25800,25 @@ free_number(mp->ty); @ @<For each of the eight cases...@>= switch (c) { case mp_rotated_operation: - if (mp_type(p) == mp_known_type) { + if (p->type == mp_known_type) { @<Install sines and cosines, then |goto done|@> } break; case mp_slanted_operation: - if (mp_type(p) > mp_pair_type) { + if (p->type > mp_pair_type) { mp_install(mp, mp_xy_part(q), p); goto DONE; } break; case mp_scaled_operation: - if (mp_type(p) > mp_pair_type) { + if (p->type > mp_pair_type) { mp_install(mp, mp_xx_part(q), p); mp_install(mp, mp_yy_part(q), p); goto DONE; } break; case mp_shifted_operation: - if (mp_type(p) == mp_pair_type) { + if (p->type == mp_pair_type) { r = mp_get_value_node(p); mp_install(mp, mp_tx_part(q), mp_x_part(r)); mp_install(mp, mp_ty_part(q), mp_y_part(r)); @@ -25830,19 +25826,19 @@ switch (c) { } break; case mp_x_scaled_operation: - if (mp_type(p) > mp_pair_type) { + if (p->type > mp_pair_type) { mp_install(mp, mp_xx_part(q), p); goto DONE; } break; case mp_y_scaled_operation: - if (mp_type(p) > mp_pair_type) { + if (p->type > mp_pair_type) { mp_install(mp, mp_yy_part(q), p); goto DONE; } break; case mp_z_scaled_operation: - if (mp_type(p) == mp_pair_type) { + if (p->type == mp_pair_type) { @<Install a complex multiplier, then |goto done|@> } break; @@ -25879,7 +25875,7 @@ goto DONE; mp_install(mp, mp_xx_part(q), mp_x_part(r)); mp_install(mp, mp_yy_part(q), mp_x_part(r)); mp_install(mp, mp_yx_part(q), mp_y_part(r)); - if (mp_type(mp_y_part(r)) == mp_known_type) { + if (mp_y_part(r)->type == mp_known_type) { mp_set_value_number(mp_y_part(r), mp_get_value_number(mp_y_part(r))); number_negate(mp_get_value_number(mp_y_part(r))); } else { @@ -25996,7 +25992,7 @@ static void mp_do_path_pen_trans (MP mp, mp_shape_node p, mp_number *sqdet, int set_number_to_zero(mp->tx); set_number_to_zero(mp->ty); mp_do_pen_trans(mp, mp_pen_ptr(p)); - if (number_nonzero(*sqdet) && ((mp_type(p) == mp_stroked_node_type) && (mp_dash_ptr(p) != NULL))) { + if (number_nonzero(*sqdet) && ((p->type == mp_stroked_node_type) && (mp_dash_ptr(p) != NULL))) { mp_number ret; new_number(ret); take_scaled(ret, ((mp_shape_node) p)->dashscale, *sqdet); @@ -26037,10 +26033,10 @@ static mp_edge_header_node mp_edges_trans (MP mp, mp_edge_header_node h) @<Try to transform the dash list of |h|@> } @<Make the bounding box of |h| unknown if it can't be updated properly without scanning the whole structure@> - q = mp_link(mp_edge_list(h)); + q = mp_edge_list(h)->link; while (q != NULL) { @<Transform graphical object |q|@> - q = mp_link(q); + q = q->link; } free_number(sqdet); return h; @@ -26088,9 +26084,9 @@ if (number_nonzero(mp->txy) || number_nonzero(mp->tyx) || number_nonzero(mp->ty) mp_set_dash_list(h, mp->null_dash); while (r != mp->null_dash) { s = r; - r = (mp_dash_node) mp_link(r); + r = (mp_dash_node) r->link; number_swap(s->start_x, s->stop_x ); - mp_link(s) = (mp_node) mp_get_dash_list(h); + s->link = (mp_node) mp_get_dash_list(h); mp_set_dash_list(h, s); } } @@ -26105,7 +26101,7 @@ r = mp_get_dash_list(h); set_number_from_addition(r->start_x, arg1, mp->tx); take_scaled(arg1, r->stop_x, mp->txx); set_number_from_addition(r->stop_x, arg1, mp->tx); - r = (mp_dash_node) mp_link(r); + r = (mp_dash_node) r->link; } free_number(arg1); } @@ -26159,7 +26155,7 @@ free_number(tot); structure~|h|. @<Transform graphical object |q|@>= -switch (mp_type(q)) { +switch (q->type) { case mp_fill_node_type: case mp_stroked_node_type: mp_do_path_trans(mp, mp_path_ptr((mp_shape_node) q)); @@ -26186,13 +26182,13 @@ some of their components are unknown. static void mp_big_trans (MP mp, mp_node p, int c) { mp_node q = mp_get_value_node(p); - if (mp_type(q) == mp_pair_node_type) { - if (mp_type(mp_x_part(q)) != mp_known_type || mp_type(mp_y_part(q)) != mp_known_type) { + if (q->type == mp_pair_node_type) { + if (mp_x_part(q)->type != mp_known_type || mp_y_part(q)->type != mp_known_type) { goto UNKNOWN; } - } else if (mp_type(mp_tx_part(q)) != mp_known_type || mp_type(mp_ty_part(q)) != mp_known_type || - mp_type(mp_xx_part(q)) != mp_known_type || mp_type(mp_xy_part(q)) != mp_known_type || - mp_type(mp_yx_part(q)) != mp_known_type || mp_type(mp_yy_part(q)) != mp_known_type) { + } else if (mp_tx_part(q)->type != mp_known_type || mp_ty_part(q)->type != mp_known_type || + mp_xx_part(q)->type != mp_known_type || mp_xy_part(q)->type != mp_known_type || + mp_yx_part(q)->type != mp_known_type || mp_yy_part(q)->type != mp_known_type) { goto UNKNOWN; } { @@ -26233,7 +26229,7 @@ static void mp_bilin1 (MP mp, mp_node p, mp_number *t, mp_node q, mp_number *u, mp_dep_mult(mp, (mp_value_node) p, t, 1); } if (number_nonzero(*u)) { - if (mp_type(q) == mp_known_type) { + if (q->type == mp_known_type) { mp_number tmp; new_number(tmp); take_scaled(tmp, mp_get_value_number(q), *u); @@ -26241,32 +26237,32 @@ static void mp_bilin1 (MP mp, mp_node p, mp_number *t, mp_node q, mp_number *u, free_number(tmp); } else { /* Ensure that |type(p)=mp_proto_dependent| */ - if (mp_type(p) != mp_proto_dependent_type) { - if (mp_type(p) == mp_known_type) { - mp_new_dep(mp, p, mp_type(p), mp_const_dependency(mp, &(mp_get_value_number(p)))); + if (p->type != mp_proto_dependent_type) { + if (p->type == mp_known_type) { + mp_new_dep(mp, p, p->type, mp_const_dependency(mp, &(mp_get_value_number(p)))); } else { mp_set_dep_list((mp_value_node) p, mp_p_times_v(mp, (mp_value_node) mp_get_dep_list((mp_value_node) p), &unity_t, mp_dependent_type, mp_proto_dependent_type, 1)); } - mp_type(p) = mp_proto_dependent_type; + p->type = mp_proto_dependent_type; } mp_set_dep_list((mp_value_node) p, mp_p_plus_fq(mp, (mp_value_node) mp_get_dep_list((mp_value_node) p), u, (mp_value_node) mp_get_dep_list((mp_value_node) q), - mp_proto_dependent_type, mp_type(q))); + mp_proto_dependent_type, q->type)); } } - if (mp_type(p) == mp_known_type) { + if (p->type == mp_known_type) { mp_set_value_number(p, mp_get_value_number(p)); number_add(mp_get_value_number(p), delta); } else { mp_number tmp; mp_value_node r = (mp_value_node) mp_get_dep_list((mp_value_node) p); while (mp_get_dep_info(r) != NULL) { - r = (mp_value_node) mp_link(r); + r = (mp_value_node) r->link; } new_number_clone(tmp, mp_get_value_number(r)); number_add(delta, tmp); @@ -26275,7 +26271,7 @@ static void mp_bilin1 (MP mp, mp_node p, mp_number *t, mp_node q, mp_number *u, mp_set_value_number(r, delta); } else { mp_recycle_value(mp, p); - mp_type(p) = mp_known_type; + p->type = mp_known_type; mp_set_value_number(p, delta); } free_number(tmp); @@ -26325,7 +26321,7 @@ to~|p|. @<Declare subroutines needed by |big_trans|@>= static void mp_add_mult_dep (MP mp, mp_value_node p, mp_number *v, mp_node r) { - if (mp_type(r) == mp_known_type) { + if (r->type == mp_known_type) { mp_number ret; new_number(ret); take_scaled(ret, mp_get_value_number(r), *v); @@ -26333,7 +26329,7 @@ static void mp_add_mult_dep (MP mp, mp_value_node p, mp_number *v, mp_node r) number_add(mp_get_dep_value(mp->dep_final), ret); free_number(ret); } else { - mp_set_dep_list(p, mp_p_plus_fq(mp, (mp_value_node) mp_get_dep_list(p), v, (mp_value_node) mp_get_dep_list((mp_value_node) r), mp_proto_dependent_type, mp_type(r))); + mp_set_dep_list(p, mp_p_plus_fq(mp, (mp_value_node) mp_get_dep_list(p), v, (mp_value_node) mp_get_dep_list((mp_value_node) r), mp_proto_dependent_type, r->type)); if (mp->fix_needed) { mp_fix_dependencies(mp); } @@ -26367,7 +26363,7 @@ static void mp_bilin2 (MP mp, mp_node p, mp_node t, mp_number *v, mp_node u, mp_ if (mp_get_dep_list((mp_value_node) p) == (mp_node) mp->dep_final) { number_clone(vv, mp_get_dep_value(mp->dep_final)); mp_recycle_value(mp, p); - mp_type(p) = mp_known_type; + p->type = mp_known_type; mp_set_value_number(p, vv); } free_number(vv); @@ -26993,7 +26989,7 @@ void mp_do_equation (MP mp) trace_equation(mp, lhs); } if (mp->cur_exp.type == mp_unknown_path_type) { - if (mp_type(lhs) == mp_pair_type) { + if (lhs->type == mp_pair_type) { mp_node p; /* temporary register */ p = mp_stash_cur_exp(mp); mp_unstash_cur_exp(mp, lhs); @@ -27110,7 +27106,7 @@ static void trace_assignment (MP mp, mp_node lhs) { mp_begin_diagnostic(mp); mp_print_nl(mp, "{"); - if (mp_name_type(lhs) == mp_internal_operation) { + if (lhs->name_type == mp_internal_operation) { mp_print_str(mp, internal_name(mp_get_sym_info(lhs))); } else { mp_show_token_list(mp, lhs, NULL); @@ -27139,7 +27135,7 @@ void mp_do_assignment (MP mp) if (number_greater(internal_value(mp_tracing_commands_internal), two_t)) { trace_assignment (mp, lhs); } - if (mp_name_type(lhs) == mp_internal_operation) { + if (lhs->name_type == mp_internal_operation) { /* Assign the current expression to an internal variable */ switch (mp->cur_exp.type) { case mp_known_type: @@ -27192,7 +27188,7 @@ void mp_do_assignment (MP mp) mp_node q = mp_stash_cur_exp(mp); /* temporary capsule for the right-hand value */ mp->cur_exp.type = mp_und_type(mp, p); mp_recycle_value(mp, p); - mp_type(p) = mp->cur_exp.type; + p->type = mp->cur_exp.type; mp_set_value_number(p, zero_t); mp_make_exp_copy(mp, p); p = mp_stash_cur_exp(mp); @@ -27218,7 +27214,7 @@ static void announce_bad_equation (MP mp, mp_node lhs) char msg[256]; mp_snprintf(msg, 256, "Equation cannot be performed (%s=%s)", - (mp_type(lhs) <= mp_pair_type ? mp_type_string(mp_type(lhs)) : "numeric"), + (lhs->type <= mp_pair_type ? mp_type_string(lhs->type) : "numeric"), (mp->cur_exp.type <= mp_pair_type ? mp_type_string(mp->cur_exp.type) : "numeric")); mp_disp_err(mp, lhs); mp_disp_err(mp, NULL); @@ -27280,7 +27276,7 @@ void mp_make_eq (MP mp, mp_node lhs) memset(&new_expr, 0, sizeof(mp_value)); new_number(v); RESTART: - t = mp_type(lhs); + t = lhs->type; if (t <= mp_pair_type) { number_clone(v, mp_get_value_number(lhs)); } @@ -27446,7 +27442,7 @@ void mp_try_eq (MP mp, mp_node l, mp_node r) Remove the left operand from its container, negate it, and put it into dependency list~|p| with constant term~|q| */ - mp_variable_type t = mp_type(l); /* the type of list |p| */ + mp_variable_type t = l->type; /* the type of list |p| */ switch (t) { case mp_known_type: { @@ -27477,12 +27473,12 @@ void mp_try_eq (MP mp, mp_node l, mp_node r) if (mp_get_dep_info(q) == NULL) { break; } else { - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; } } - mp_link(mp_get_prev_dep(ll)) = mp_link(q); - mp_set_prev_dep((mp_value_node) mp_link(q), mp_get_prev_dep(ll)); - mp_type(ll) = mp_known_type; + mp_get_prev_dep(ll)->link = q->link; + mp_set_prev_dep((mp_value_node) q->link, mp_get_prev_dep(ll)); + ll->type = mp_known_type; } break; } @@ -27499,11 +27495,11 @@ void mp_try_eq (MP mp, mp_node l, mp_node r) pp = (mp_value_node) mp_get_dep_list((mp_value_node) cur_exp_node); } } - } else if (mp_type(r) == mp_known_type) { + } else if (r->type == mp_known_type) { number_add(mp_get_dep_value(q), mp_get_value_number(r)); goto DONE1; } else { - tt = mp_type(r); + tt = r->type; if (tt == mp_independent_type) { pp = mp_single_dependency(mp, r); } else { @@ -27530,7 +27526,7 @@ void mp_try_eq (MP mp, mp_node l, mp_node r) number_clone(x, mp_get_dep_value(q)); fraction_to_round_scaled(x); mp_set_dep_value(q, x); - q = (mp_value_node) mp_link(q); + q = (mp_value_node) q->link; } free_number(x); t = mp_proto_dependent_type; @@ -27545,7 +27541,7 @@ void mp_try_eq (MP mp, mp_node l, mp_node r) deal_with_redundant_or_inconsistent_equation(mp, p, r); } else { mp_linear_eq(mp, p, (int) t); - if (r == NULL && mp->cur_exp.type != mp_known_type && mp_type(cur_exp_node) == mp_known_type) { + if (r == NULL && mp->cur_exp.type != mp_known_type && cur_exp_node->type == mp_known_type) { mp_node pp = cur_exp_node; mp_set_cur_exp_value_number(mp, &(mp_get_value_number(pp))); mp->cur_exp.type = mp_known_type; @@ -27604,10 +27600,10 @@ mp_node mp_scan_declared_variable (MP mp) } } } - mp_link(t) = mp_new_symbolic_node(mp); - t = mp_link(t); + t->link = mp_new_symbolic_node(mp); + t = t->link; mp_set_sym_sym(t, cur_sym); - mp_name_type(t) = cur_sym_mod; + t->name_type = cur_sym_mod; } if (eq_property(x) != 0) { mp_check_overload(mp, x); @@ -27685,10 +27681,10 @@ void mp_do_type_declaration (MP mp) do { mp_node p = mp_scan_declared_variable(mp); /* token list for a declared variable */ mp_node q; /* value node for the variable */ - mp_flush_variable(mp, equiv_node(mp_get_sym_sym(p)), mp_link(p), 0); + mp_flush_variable(mp, equiv_node(mp_get_sym_sym(p)), p->link, 0); q = mp_find_variable(mp, p); if (q != NULL) { - mp_type(q) = t; + q->type = t; mp_set_value_number(q, zero_t); /* todo: this was |null| */ } else { mp_back_error( @@ -28670,28 +28666,28 @@ static void mp_disp_var (MP mp, mp_node p); @ @c void mp_disp_var (MP mp, mp_node p) { - if (mp_type(p) == mp_structured_type) { + if (p->type == mp_structured_type) { /* Descend the structure */ mp_node q = mp_get_attribute_head(p); do { mp_disp_var(mp, q); - q = mp_link(q); + q = q->link; } while (q != mp->end_attr); q = mp_get_subscr_head(p); - while (mp_name_type(q) == mp_subscript_operation) { + while (q->name_type == mp_subscript_operation) { mp_disp_var(mp, q); - q = mp_link(q); + q = q->link; } - } else if (mp_type(p) >= mp_unsuffixed_macro_type) { + } else if (p->type >= mp_unsuffixed_macro_type) { /* Display a variable macro */ mp_print_nl(mp, ""); mp_print_variable_name(mp, p); - if (mp_type(p) > mp_unsuffixed_macro_type) { + if (p->type > mp_unsuffixed_macro_type) { mp_print_str(mp, "@@#"); /* |suffixed_macro| */ } mp_print_str(mp, "=macro:"); mp_show_macro(mp, mp_get_value_node(p), NULL); - } else if (mp_type(p) != mp_undefined_type) { + } else if (p->type != mp_undefined_type) { mp_print_nl(mp, ""); mp_print_variable_name(mp, p); mp_print_chr(mp, '='); @@ -28726,22 +28722,23 @@ static void mp_do_show_dependencies (MP mp); void mp_do_show_dependencies (MP mp) { /* link that runs through all dependencies */ - mp_value_node p = (mp_value_node) mp_link(mp->dep_head); + mp_value_node p = (mp_value_node) mp->dep_head->link; while (p != mp->dep_head) { if (mp_interesting(mp, (mp_node) p)) { mp_print_nl(mp, ""); mp_print_variable_name(mp, (mp_node) p); - if (mp_type(p) == mp_dependent_type) { + if (p->type == mp_dependent_type) { mp_print_chr(mp, '='); } else { mp_print_str(mp, " = "); /* extra spaces imply proto-dependency */ } - mp_print_dependency(mp, (mp_value_node) mp_get_dep_list(p), mp_type(p)); + mp_print_dependency(mp, (mp_value_node) mp_get_dep_list(p), p->type); } p = (mp_value_node) mp_get_dep_list(p); - while (mp_get_dep_info(p) != NULL) - p = (mp_value_node) mp_link(p); - p = (mp_value_node) mp_link(p); + while (mp_get_dep_info(p) != NULL) { + p = (mp_value_node) p->link; + } + p = (mp_value_node) p->link; } mp_get_x_next(mp); } @@ -28899,7 +28896,7 @@ will ever contain a color outside the legal range for \ps\ graphics. if (mp_has_color(cp)) { break; } else { - cp = mp_link(cp); + cp = cp->link; } } } while (0) @@ -29203,12 +29200,12 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) if (mp_has_pen(pp)) { break; } else { - pp = mp_link(pp); + pp = pp->link; } } } if (pp != NULL) { - switch (mp_type(pp)) { + switch (pp->type) { case mp_fill_node_type: case mp_stroked_node_type: if (mp_pen_ptr((mp_shape_node) pp) != NULL) { @@ -29233,7 +29230,7 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) ap = p; } while ((ap != NULL) && (! mp_has_script(ap))) { - ap = mp_link(ap); + ap = ap->link; } if (ap != NULL) { if (mp_pre_script(ap) != NULL) { @@ -29265,7 +29262,7 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) bp = p; } while ((bp != NULL) && (! mp_has_script(bp))) { - bp = mp_link(bp); + bp = bp->link; } if (bp != NULL) { if (mp_post_script(bp) != NULL) { @@ -29395,10 +29392,10 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) /* Make |dp| a stroked node in list~|p| */ dp = p; while (dp != NULL) { - if (mp_type(dp) == mp_stroked_node_type) { + if (dp->type == mp_stroked_node_type) { break; } else { - dp = mp_link(dp); + dp = dp->link; } } } @@ -29420,7 +29417,7 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) */ if (cp > MP_VOID) { /* Copy |cp|'s color into the colored objects linked to~|cp| */ - mp_node q = mp_link(cp); + mp_node q = cp->link; while (q != NULL) { if (mp_has_color(q)) { mp_shape_node q0 = (mp_shape_node) q; @@ -29431,15 +29428,15 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) number_clone(q0->black, cp0->black); mp_color_model(q) = mp_color_model(cp); } - q = mp_link(q); + q = q->link; } } if (pp > MP_VOID) { /* Copy |mp_pen_ptr(pp)| into stroked and filled nodes linked to |pp| */ - mp_node q = mp_link(pp); + mp_node q = pp->link; while (q != NULL) { if (mp_has_pen(q)) { - switch (mp_type(q)) { + switch (q->type) { case mp_fill_node_type: case mp_stroked_node_type: if (mp_pen_ptr((mp_shape_node) q) != NULL) { @@ -29451,14 +29448,14 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) break; } } - q = mp_link(q); + q = q->link; } } if (dp > MP_VOID) { /* Make stroked nodes linked to |dp| refer to |mp_dash_ptr(dp)| */ - mp_node q = mp_link(dp); + mp_node q = dp->link; while (q != NULL) { - if (mp_type(q) == mp_stroked_node_type) { + if (q->type == mp_stroked_node_type) { if (mp_dash_ptr(q) != NULL) { mp_delete_edge_ref(mp, mp_dash_ptr(q)); } @@ -29468,13 +29465,13 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) mp_add_edge_ref(mp, mp_dash_ptr(q)); } } - q = mp_link(q); + q = q->link; } } if (linecap >= 0 && linecap < mp_weird_linecap_code) { mp_node q = p; while (q != NULL) { - switch (mp_type(q)) { + switch (q->type) { case mp_fill_node_type: case mp_stroked_node_type: mp_set_linecap(q, linecap); @@ -29482,13 +29479,13 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) default: break; } - q = mp_link(q); + q = q->link; } } if (linejoin >= 0 && linejoin < mp_weird_linejoin_code) { mp_node q = p; while (q != NULL) { - switch (mp_type(q)) { + switch (q->type) { case mp_fill_node_type: case mp_stroked_node_type: mp_set_linejoin(q, linejoin); @@ -29496,13 +29493,13 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) default: break; } - q = mp_link(q); + q = q->link; } } if (miterlimit) { mp_node q = p; while (q != NULL) { - switch (mp_type(q)) { + switch (q->type) { case mp_fill_node_type: case mp_stroked_node_type: number_clone(mp_miterlimit(q), ml); @@ -29510,15 +29507,15 @@ void mp_scan_with_list (MP mp, mp_node p, mp_node pstop) default: break; } - q = mp_link(q); + q = q->link; } free_number(ml); } if (! pp && sp > MP_VOID) { - mp_node q = mp_link(sp); + mp_node q = sp->link; while (q != NULL) { mp_stacking(q) = mp_stacking(sp); - q = mp_link(q); + q = q->link; } } } @@ -29548,7 +29545,7 @@ mp_edge_header_node mp_find_edges_var (MP mp, mp_node t) ); mp_memory_free(msg); mp_get_x_next(mp); - } else if (mp_type(p) != mp_picture_type) { + } else if (p->type != mp_picture_type) { char msg[256]; mp_string sname; int selector = mp->selector; @@ -29556,7 +29553,7 @@ mp_edge_header_node mp_find_edges_var (MP mp, mp_node t) mp_show_token_list(mp, t, NULL); sname = mp_make_string(mp); mp->selector = selector; - mp_snprintf(msg, 256, "Variable %s is the wrong type(%s)", mp_str(mp, sname), mp_type_string(mp_type(p))); + mp_snprintf(msg, 256, "Variable %s is the wrong type(%s)", mp_str(mp, sname), mp_type_string(p->type)); @.Variable x is the wrong type@> delete_str_ref(sname); mp_back_error( @@ -29693,12 +29690,12 @@ void mp_do_bounds (MP mp) } pp = mp_new_bounds_node(mp, NULL, mm); mp_scan_with_list(mp, p, pp); - mp_link(p) = mp_link(mp_edge_list(lhe)); - mp_link(mp_edge_list(lhe)) = p; + p->link = mp_edge_list(lhe)->link; + mp_edge_list(lhe)->link = p; if (mp_obj_tail(lhe) == mp_edge_list(lhe)) { mp_obj_tail(lhe) = p; } - mp_link(mp_obj_tail(lhe)) = pp; + mp_obj_tail(lhe)->link = pp; mp_obj_tail(lhe) = pp; mp_init_bbox(mp, lhe); } @@ -29745,7 +29742,7 @@ void mp_do_add_to (MP mp) } else { e = mp_private_edges(mp, (mp_edge_header_node) cur_exp_node); mp->cur_exp.type = mp_vacuous_type; - p = mp_link(mp_edge_list(e)); + p = mp_edge_list(e)->link; } } else { /* @@ -29802,17 +29799,17 @@ void mp_do_add_to (MP mp) } else if (add_type == mp_add_also_code) { if (e != NULL) { /* Merge |e| into |lhe| and delete |e| */ - if (mp_link(mp_edge_list(e)) != NULL) { - mp_link(mp_obj_tail(lhe)) = mp_link(mp_edge_list(e)); + if (mp_edge_list(e)->link != NULL) { + mp_obj_tail(lhe)->link = mp_edge_list(e)->link; mp_obj_tail(lhe) = mp_obj_tail(e); mp_obj_tail(e) = mp_edge_list(e); - mp_link(mp_edge_list(e)) = NULL; + mp_edge_list(e)->link = NULL; mp_flush_dash_list(mp, lhe); } mp_toss_edges(mp, e); } } else if (p != NULL) { - mp_link(mp_obj_tail(lhe)) = p; + mp_obj_tail(lhe)->link = p; mp_obj_tail(lhe) = p; if (add_type == mp_add_double_path_code) { if (mp_pen_ptr((mp_shape_node) p) == NULL) { @@ -30225,13 +30222,13 @@ typedef struct mp_edge_object { @d mp_gr_export_color(q,p) if (mp_color_model(p) == mp_uninitialized_model) { - gr_color_model(q) = number_to_scaled(internal_value(mp_default_color_model_internal))/65536; + gr_color_model(q) = (unsigned char) (number_to_scaled(internal_value(mp_default_color_model_internal))/65536); gr_cyan_val(q) = 0; gr_magenta_val(q) = 0; gr_yellow_val(q) = 0; gr_black_val(q) = gr_color_model(q) == mp_cmyk_model ? (number_to_scaled(unity_t)/65536.0) : 0; } else { - gr_color_model(q) = mp_color_model(p); + gr_color_model(q) = (unsigned char) mp_color_model(p); gr_cyan_val(q) = number_to_double(p->cyan); gr_magenta_val(q) = number_to_double(p->magenta); gr_yellow_val(q) = number_to_double(p->yellow); @@ -30271,10 +30268,10 @@ struct mp_edge_object *mp_gr_export (MP mp, mp_edge_header_node h) hh->height = number_to_double(internal_value(mp_char_ht_internal)); hh->depth = number_to_double(internal_value(mp_char_dp_internal)); hh->italic = number_to_double(internal_value(mp_char_ic_internal)); - p = mp_link(mp_edge_list(h)); + p = mp_edge_list(h)->link; while (p != NULL) { - mp_graphic_object *hq = mp_new_graphic_object(mp, (int) ((mp_type(p) - mp_fill_node_type) + 1)); - switch (mp_type(p)) { + mp_graphic_object *hq = mp_new_graphic_object(mp, (int) ((p->type - mp_fill_node_type) + 1)); + switch (p->type) { /* todo: share code between fill and stroked */ case mp_fill_node_type: { @@ -30366,7 +30363,7 @@ struct mp_edge_object *mp_gr_export (MP mp, mp_edge_header_node h) gr_link(hp) = hq; } hp = hq; - p = mp_link(p); + p = p->link; } return hh; } @@ -30563,8 +30560,8 @@ only serialize symbolic names, strings and single tokens. // p = mp_cur_tok(mp); // if (p) { // /* simplified mp_show_token_list */ -// if (mp_type(p) == mp_symbol_node_type) { -// // if (mp_name_type(p) != mp_expr_operation && mp_name_type(p) != mp_suffix_operation && mp_name_type(p) != mp_text_operation) { +// if (p->type == mp_symbol_node_type) { +// // if (p->name_type != mp_expr_operation && p->name_type != mp_suffix_operation && p->name_type != mp_text_operation) { // mp_sym sr = mp_get_sym_sym(p); // // if (sr != mp_collective_subscript) { // mp_string rr = text(sr); @@ -30573,8 +30570,8 @@ only serialize symbolic names, strings and single tokens. // } // // } // // } -// } else if (mp_name_type(p) == mp_token_operation) { -// if (mp_type(p) == mp_string_type) { +// } else if (p->name_type == mp_token_operation) { +// if (p->type == mp_string_type) { // r = mp_get_value_str(p)->str; // } // } @@ -30604,15 +30601,15 @@ void mp_scan_symbol_value (MP mp, int keep, char **s, int expand) unsigned char *r = NULL; mp_node p = mp_new_symbolic_node(mp); mp_set_sym_sym(p, cur_sym); - mp_name_type(p) = cur_sym_mod; - if (mp_type(p) == mp_symbol_node_type) { + p->name_type = cur_sym_mod; + if (p->type == mp_symbol_node_type) { mp_sym sr = mp_get_sym_sym(p); mp_string rr = text(sr); if (rr && rr->str) { r = rr->str; } - } else if (mp_name_type(p) == mp_token_operation) { - if (mp_type(p) == mp_string_type) { + } else if (p->name_type == mp_token_operation) { + if (p->type == mp_string_type) { r = mp_get_value_str(p)->str; } } @@ -30725,7 +30722,7 @@ void mp_scan_numeric_value (MP mp, int primary, double *d) } # define mp_set_double_value(mp,target,what) \ -if (mp_type(what) == mp_known_type) { \ +if (what->type == mp_known_type) { \ *target = number_to_double(mp_get_value_number(what)); \ } @@ -30887,8 +30884,8 @@ void mp_push_pair_value (MP mp, double x, double y) v = mp_get_value_node(p); new_number_from_double(mp, px, x); new_number_from_double(mp, py, y); - mp_type(mp_x_part(v)) = mp_known_type; - mp_type(mp_y_part(v)) = mp_known_type; + mp_x_part(v)->type = mp_known_type; + mp_y_part(v)->type = mp_known_type; mp_set_value_number(mp_x_part(v), px); mp_set_value_number(mp_y_part(v), py); free_number(px); @@ -30896,13 +30893,13 @@ void mp_push_pair_value (MP mp, double x, double y) /* memset(&new_expr, 0, sizeof(mp_value)); new_number(new_expr.data.n); - new_expr.type = mp_type(p); + new_expr.type = p->type; new_expr.data.node = p; mp_flush_cur_exp(mp, new_expr); mp->cur_exp.type = mp_pair_type; - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; */ - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp->cur_exp.type = mp_pair_type; mp_set_cur_exp_node(mp, p); mp_back_expr(mp); @@ -30918,16 +30915,16 @@ void mp_push_color_value (MP mp, double r, double g, double b) new_number_from_double(mp, pr, r); new_number_from_double(mp, pg, g); new_number_from_double(mp, pb, b); - mp_type(mp_red_part (v)) = mp_known_type; - mp_type(mp_green_part(v)) = mp_known_type; - mp_type(mp_blue_part (v)) = mp_known_type; + mp_red_part (v)->type = mp_known_type; + mp_green_part(v)->type = mp_known_type; + mp_blue_part (v)->type = mp_known_type; mp_set_value_number(mp_red_part (v), pr); mp_set_value_number(mp_green_part(v), pg); mp_set_value_number(mp_blue_part (v), pb); free_number(pr); free_number(pg); free_number(pb); - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp->cur_exp.type = mp_color_type; mp_set_cur_exp_node(mp, p); mp_back_expr(mp); @@ -30944,10 +30941,10 @@ void mp_push_cmykcolor_value (MP mp, double c, double m, double y, double k) new_number_from_double(mp, pm, m); new_number_from_double(mp, py, y); new_number_from_double(mp, pk, k); - mp_type(mp_cyan_part (v)) = mp_known_type; - mp_type(mp_magenta_part(v)) = mp_known_type; - mp_type(mp_yellow_part (v)) = mp_known_type; - mp_type(mp_black_part (v)) = mp_known_type; + mp_cyan_part (v)->type = mp_known_type; + mp_magenta_part(v)->type = mp_known_type; + mp_yellow_part (v)->type = mp_known_type; + mp_black_part (v)->type = mp_known_type; mp_set_value_number(mp_cyan_part (v), pc); mp_set_value_number(mp_magenta_part(v), pm); mp_set_value_number(mp_yellow_part (v), py); @@ -30956,7 +30953,7 @@ void mp_push_cmykcolor_value (MP mp, double c, double m, double y, double k) free_number(pm); free_number(py); free_number(pk); - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp->cur_exp.type = mp_cmykcolor_type; mp_set_cur_exp_node(mp, p); mp_back_expr(mp); @@ -30975,12 +30972,12 @@ void mp_push_transform_value (MP mp, double x, double y, double xx, double xy, d new_number_from_double(mp, pxy, xy); new_number_from_double(mp, pyx, yx); new_number_from_double(mp, pyy, yy); - mp_type(mp_x_part (v)) = mp_known_type; - mp_type(mp_y_part (v)) = mp_known_type; - mp_type(mp_xx_part(v)) = mp_known_type; - mp_type(mp_xy_part(v)) = mp_known_type; - mp_type(mp_yx_part(v)) = mp_known_type; - mp_type(mp_yy_part(v)) = mp_known_type; + mp_x_part (v)->type = mp_known_type; + mp_y_part (v)->type = mp_known_type; + mp_xx_part(v)->type = mp_known_type; + mp_xy_part(v)->type = mp_known_type; + mp_yx_part(v)->type = mp_known_type; + mp_yy_part(v)->type = mp_known_type; mp_set_value_number(mp_x_part (v), px); mp_set_value_number(mp_y_part (v), py); mp_set_value_number(mp_xx_part(v), pxx); @@ -30993,7 +30990,7 @@ void mp_push_transform_value (MP mp, double x, double y, double xx, double xy, d free_number(pxy); free_number(pyx); free_number(pyy); - mp_name_type(p) = mp_capsule_operation; + p->name_type = mp_capsule_operation; mp->cur_exp.type = mp_transform_type; mp_set_cur_exp_node(mp, p); mp_back_expr(mp); @@ -31114,8 +31111,8 @@ void mp_final_cleanup (MP mp) } mp_print_str(mp, " was incomplete)"); mp->if_line = mp_if_line_field(mp->cond_ptr); - mp->cur_if = mp_name_type(mp->cond_ptr); - mp->cond_ptr = mp_link(mp->cond_ptr); + mp->cur_if = mp->cond_ptr->name_type; + mp->cond_ptr = mp->cond_ptr->link; } if (mp->history != mp_spotless) { if (((mp->history == mp_warning_issued) || (mp->interaction < mp_error_stop_mode))) { diff --git a/source/luametatex/source/mp/mpw/mpmath.w b/source/luametatex/source/mp/mpw/mpmath.w index b9001a61b..5e9592fc7 100644 --- a/source/luametatex/source/mp/mpw/mpmath.w +++ b/source/luametatex/source/mp/mpw/mpmath.w @@ -665,9 +665,9 @@ possibly become zero. We round to five digits @ @c static char *mp_string_scaled (MP mp, int s) { - (void) mp; static char scaled_string[32]; int i = 0; + (void) mp; if (s < 0) { scaled_string[i++] = '-'; s = -s; diff --git a/source/luametatex/source/mp/mpw/mpmathdecimal.w b/source/luametatex/source/mp/mpw/mpmathdecimal.w index 7854a4ff5..124c77ecb 100644 --- a/source/luametatex/source/mp/mpw/mpmathdecimal.w +++ b/source/luametatex/source/mp/mpw/mpmathdecimal.w @@ -866,19 +866,19 @@ Bad! @c int mp_number_to_scaled(mp_number *A) { - int32_t result; + int result; decNumber corrected; decNumberFromInt32(&corrected, 65536); decNumberMultiply(&corrected, &corrected, A->data.num, &mp_decimal_data.set); decNumberReduce(&corrected, &corrected, &mp_decimal_data.set); - result = (int) floor(decNumberToDouble(&corrected) + 0.5); + result = lround(decNumberToDouble(&corrected)); return result; } @ @c int mp_number_to_int(mp_number *A) { - int32_t result; + int result; mp_decimal_data.set.status = 0; result = decNumberToInt32(A->data.num, &mp_decimal_data.set); if (mp_decimal_data.set.status == DEC_Invalid_operation) { @@ -892,7 +892,7 @@ int mp_number_to_int(mp_number *A) int mp_number_to_boolean(mp_number *A) { - uint32_t result; + unsigned int result; mp_decimal_data.set.status = 0; result = decNumberToUInt32(A->data.num, &mp_decimal_data.set); if (mp_decimal_data.set.status == DEC_Invalid_operation) { @@ -1737,7 +1737,7 @@ typedef struct mp_decimal_random_info { long *ptr; } mp_decimal_random_info; -mp_decimal_random_info mp_decimal_random_data = { +static mp_decimal_random_info mp_decimal_random_data = { .dummy = -1, .started = -1, .ptr = &mp_decimal_random_data.dummy diff --git a/source/luametatex/source/mp/mpw/mpmathdouble.w b/source/luametatex/source/mp/mpw/mpmathdouble.w index 83741794b..ab9caf460 100644 --- a/source/luametatex/source/mp/mpw/mpmathdouble.w +++ b/source/luametatex/source/mp/mpw/mpmathdouble.w @@ -1270,7 +1270,7 @@ typedef struct mp_double_random_info { long *ptr; } mp_double_random_info; -mp_double_random_info mp_double_random_data = { +static mp_double_random_info mp_double_random_data = { .dummy = -1, .started = -1, .ptr = &mp_double_random_data.dummy diff --git a/source/luametatex/source/mp/mpw/mpstrings.w b/source/luametatex/source/mp/mpw/mpstrings.w index 07236bd9c..b8e421b00 100644 --- a/source/luametatex/source/mp/mpw/mpstrings.w +++ b/source/luametatex/source/mp/mpw/mpstrings.w @@ -438,7 +438,7 @@ mp_string mp_chop_string(MP mp, mp_string s, int a, int b) a = l; } } - mp_str_room(mp, (size_t) (b - a)); + mp_str_room(mp, (b - a)); if (reversed) { for (int k = b - 1; k >= a; k--) { mp_append_char(mp, *(s->str + k)); diff --git a/source/luametatex/source/tex/texbuildpage.c b/source/luametatex/source/tex/texbuildpage.c index 0e2883305..0cf8b70e9 100644 --- a/source/luametatex/source/tex/texbuildpage.c +++ b/source/luametatex/source/tex/texbuildpage.c @@ -1011,8 +1011,8 @@ static void tex_aux_fire_up(halfword c) wait = 1; } } + split_best_insert(r) = null; { - split_best_insert(r) = null; /*tex We need this juggling in order to also set the old school box when we're in traditional mode. diff --git a/source/luametatex/source/tex/texcommands.c b/source/luametatex/source/tex/texcommands.c index f0949b9ab..5a4cc48b3 100644 --- a/source/luametatex/source/tex/texcommands.c +++ b/source/luametatex/source/tex/texcommands.c @@ -138,6 +138,7 @@ void tex_initialize_commands(void) tex_primitive(tex_command, "exhyphenchar", internal_int_cmd, ex_hyphen_char_code, internal_int_base); tex_primitive(tex_command, "exhyphenpenalty", internal_int_cmd, ex_hyphen_penalty_code, internal_int_base); tex_primitive(tex_command, "fam", internal_int_cmd, family_code, internal_int_base); + tex_primitive(luatex_command, "variablefam", internal_int_cmd, variable_family_code, internal_int_base); tex_primitive(tex_command, "finalhyphendemerits", internal_int_cmd, final_hyphen_demerits_code, internal_int_base); tex_primitive(tex_command, "floatingpenalty", internal_int_cmd, floating_penalty_code, internal_int_base); tex_primitive(tex_command, "globaldefs", internal_int_cmd, global_defs_code, internal_int_base); @@ -743,6 +744,7 @@ void tex_initialize_commands(void) tex_primitive(tex_command, "hyphenchar", set_font_property_cmd, font_hyphen_code, 0); tex_primitive(tex_command, "skewchar", set_font_property_cmd, font_skew_code, 0); tex_primitive(luatex_command, "efcode", set_font_property_cmd, font_ef_code, 0); + tex_primitive(luatex_command, "cfcode", set_font_property_cmd, font_cf_code, 0); tex_primitive(luatex_command, "lpcode", set_font_property_cmd, font_lp_code, 0); tex_primitive(luatex_command, "rpcode", set_font_property_cmd, font_rp_code, 0); tex_primitive(tex_command, "fontdimen", set_font_property_cmd, font_dimen_code, 0); diff --git a/source/luametatex/source/tex/texcommands.h b/source/luametatex/source/tex/texcommands.h index 792e23662..6d85f1ed7 100644 --- a/source/luametatex/source/tex/texcommands.h +++ b/source/luametatex/source/tex/texcommands.h @@ -462,12 +462,16 @@ typedef enum convert_codes { # define first_convert_code number_code # define last_convert_code luatex_banner_code +/*tex + At some point we might make |token_input_code| behave like |tex_token_input_code| and get rid + of |\everyeof| which is a quite useless feature that does more harm than good. +*/ + typedef enum input_codes { normal_input_code, end_of_input_code, token_input_code, tex_token_input_code, - /* for now private */ tokenized_code, retokenized_code, quit_loop_code, @@ -577,6 +581,7 @@ typedef enum font_property_codes { font_lp_code, font_rp_code, font_ef_code, + font_cf_code, font_dimen_code, scaled_font_dimen_code, } font_property_codes; @@ -1067,7 +1072,7 @@ typedef enum math_styles { # define first_math_style display_style # define last_math_style all_cramped_styles -# define is_valid_math_style(n) (n >= display_style && n <= cramped_script_script_style) +# define is_valid_math_style(n) (n >= display_style && n <= cramped_script_script_style) # define are_valid_math_styles(n) (n >= all_display_styles && n <= all_cramped_styles) inline static halfword tex_math_style_to_size(halfword s) diff --git a/source/luametatex/source/tex/texconditional.c b/source/luametatex/source/tex/texconditional.c index b25bdfbbe..be68a8d6d 100644 --- a/source/luametatex/source/tex/texconditional.c +++ b/source/luametatex/source/tex/texconditional.c @@ -349,16 +349,19 @@ static void tex_aux_show_if_state(halfword code, halfword case_value) { tex_begin_diagnostic(); switch (code) { - case if_chk_int_code : tex_print_format("{chknum %i}", case_value); break; - case if_val_int_code : tex_print_format("{numval %i}", case_value); break; - case if_cmp_int_code : tex_print_format("{cmpnum %i}", case_value); break; - case if_chk_dim_code : tex_print_format("{chkdim %i}", case_value); break; - case if_val_dim_code : tex_print_format("{dimval %i}", case_value); break; - case if_cmp_dim_code : tex_print_format("{cmpdim %i}", case_value); break; - case if_case_code : tex_print_format("{case %i}", case_value); break; - case if_math_style_code: tex_print_format("{mathstyle %i}", case_value); break; - case if_arguments_code : tex_print_format("{arguments %i}", case_value); break; - default : tex_print_format("{todo %i}", case_value); break; + case if_chk_int_code : tex_print_format("{chknum %i}", case_value); break; + case if_val_int_code : tex_print_format("{numval %i}", case_value); break; + case if_cmp_int_code : tex_print_format("{cmpnum %i}", case_value); break; + case if_chk_dim_code : tex_print_format("{chkdim %i}", case_value); break; + case if_val_dim_code : tex_print_format("{dimval %i}", case_value); break; + case if_cmp_dim_code : tex_print_format("{cmpdim %i}", case_value); break; + case if_case_code : tex_print_format("{case %i}", case_value); break; + case if_math_parameter_code: tex_print_format("{mathparameter %i}", case_value); break; + case if_math_style_code : tex_print_format("{mathstyle %i}", case_value); break; + case if_arguments_code : tex_print_format("{arguments %i}", case_value); break; + case if_parameters_code : tex_print_format("{parameter %i}", case_value); break; + case if_parameter_code : tex_print_format("{parameters %i}", case_value); break; + default : tex_print_format("{todo %i}", case_value); break; } tex_end_diagnostic(); } @@ -776,38 +779,44 @@ void tex_conditional_if(halfword code, int unless) goto RESULT; case if_flags_code: { - singleword flag, fl; + halfword cs; + singleword flag; tex_get_r_token(); - flag = eq_flag(cur_cs); + cs = cur_cs; + flag = eq_flag(cs); /* todo: each prefix */ tex_get_token(); if (cur_cmd == prefix_cmd) { switch (cur_chr) { - case permanent_code : result = is_permanent (flag); break; - case immutable_code : result = is_immutable (flag); break; - case mutable_code : result = is_mutable (flag); break; - case noaligned_code : result = is_noaligned (flag); break; - case instance_code : result = is_instance (flag); break; - case untraced_code : result = is_untraced (flag); break; - case global_code : result = is_global (flag); break; - case tolerant_code : result = is_tolerant (flag); break; - case protected_code : result = is_protected (flag); break; - case overloaded_code : result = is_overloaded (flag); break; - case aliased_code : result = is_aliased (flag); break; - case immediate_code : result = is_immediate (flag); break; - case semiprotected_code : result = is_semiprotected(flag); break; + /*tex We check flags: */ + case frozen_code : result = is_frozen (flag); break; + case permanent_code : result = is_permanent(flag); break; + case immutable_code : result = is_immutable(flag); break; + /* case primitive_code : result = is_primitive(flag); break; */ + case mutable_code : result = is_mutable (flag); break; + case noaligned_code : result = is_noaligned(flag); break; + case instance_code : result = is_instance (flag); break; + case untraced_code : result = is_untraced (flag); break; + /*tex We check cmd: */ + case global_code : result = eq_level(cs) == level_one;; break; + case tolerant_code : result = is_tolerant_cmd(eq_type(cs)); break; + case protected_code : result = is_protected_cmd(eq_type(cs)); break; + case semiprotected_code : result = is_semi_protected_cmd(eq_type(cs)); break; } } else { + int fl; tex_back_input(cur_tok); - fl = (singleword) tex_scan_int(1, NULL); /* maybe some checking or masking is needed here */ + fl = tex_scan_int(1, NULL); result = (flag & fl) == fl; if (! result) { if (is_protected(fl)) { - result = is_protected_cmd(eq_type(cur_cs)); + result = is_protected_cmd(eq_type(cs)); + } else if (is_semiprotected(fl)) { + result = is_semi_protected_cmd(eq_type(cs)); } else if (is_tolerant(fl)) { - result = is_tolerant_cmd(eq_type(cur_cs)); + result = is_tolerant_cmd(eq_type(cs)); } else if (is_global(fl)) { - result = eq_level(cur_cs) == level_one; + result = eq_level(cs) == level_one; } } } diff --git a/source/luametatex/source/tex/texdumpdata.h b/source/luametatex/source/tex/texdumpdata.h index bea80869d..e6f51d323 100644 --- a/source/luametatex/source/tex/texdumpdata.h +++ b/source/luametatex/source/tex/texdumpdata.h @@ -55,7 +55,7 @@ */ -# define luametatex_format_fingerprint 674 +# define luametatex_format_fingerprint 675 /* These end up in the string pool. */ @@ -71,8 +71,11 @@ extern int tex_load_fmt_file (void); extern int tex_fatal_undump_error (const char *s); extern void tex_initialize_dump_state (void); -# define dump_items(f,p,item_size,nitems) fwrite((void *) p, (size_t) item_size, (size_t) nitems, f) -# define undump_items(f,p,item_size,nitems) { if (fread ((void *) p, (size_t) item_size, (size_t) nitems, f)) { } } +//define dump_items(f,p,item_size,nitems) fwrite((void *) p, (size_t) item_size, (size_t) nitems, f) +//define undump_items(f,p,item_size,nitems) { if (fread ((void *) p, (size_t) item_size, (size_t) nitems, f)) { } } + +# define dump_items(f,p,item_size,nitems) fwrite((void *) p, (size_t) item_size, (size_t) nitems, f) +# define undump_items(f,p,item_size,nitems) fread ((void *) p, (size_t) item_size, (size_t) nitems, f) # define dump_things(f,base,len) dump_items(f, (char *) &(base), sizeof (base), (int) (len)) # define undump_things(f,base,len) undump_items(f, (char *) &(base), sizeof (base), (int) (len)) diff --git a/source/luametatex/source/tex/texequivalents.c b/source/luametatex/source/tex/texequivalents.c index aa434d8fd..4de7617c9 100644 --- a/source/luametatex/source/tex/texequivalents.c +++ b/source/luametatex/source/tex/texequivalents.c @@ -711,8 +711,8 @@ void tex_show_save_groups(void) FOUND1: { /*tex Show the box packaging info. */ - tex_print_str_esc(package); halfword packing, amount; + tex_print_str_esc(package); if (tex_aux_saved_box_spec(&packing, &amount)) { tex_print_str(packing == packing_exactly ? " to " : " spread "); tex_print_dimension(amount, pt_unit); @@ -1970,3 +1970,18 @@ int tex_located_save_value(int id) } return 0; } + +extern int tex_cs_state(halfword p) +{ + if (p == null_cs) { + return cs_null_error; + } else if (p < hash_base) { + return cs_below_base_error; + } else if (p == undefined_control_sequence) { + return cs_undefined_error; + } else if (eqtb_out_of_range(p)) { + return cs_out_of_range_error; + } else { + return cs_no_error; + } +} diff --git a/source/luametatex/source/tex/texequivalents.h b/source/luametatex/source/tex/texequivalents.h index 24a1729f9..2feab6858 100644 --- a/source/luametatex/source/tex/texequivalents.h +++ b/source/luametatex/source/tex/texequivalents.h @@ -571,6 +571,7 @@ typedef enum int_codes { alignment_wrap_source_code, /* page_boundary_penalty_code, */ line_break_criterium_code, + variable_family_code, /* those below these are not interfaced via primitives */ internal_par_state_code, internal_dir_state_code, @@ -1347,6 +1348,7 @@ extern void tex_forced_word_define (int g, halfword p, singleword flag, halfword # define split_top_skip_par glue_parameter(split_top_skip_code) # define cur_fam_par count_parameter(family_code) +# define variable_family_par count_parameter(variable_family_code) # define pre_display_direction_par count_parameter(pre_display_direction_code) # define pre_display_penalty_par count_parameter(pre_display_penalty_code) # define post_display_penalty_par count_parameter(post_display_penalty_code) @@ -1705,6 +1707,7 @@ extern halfword tex_explicit_disc_penalty (halfword mode); # define update_tex_glyph_state(a,v) tex_word_define(a, internal_int_location(glyph_state_code), v) # define update_tex_glyph_script(a,v) tex_word_define(a, internal_int_location(glyph_script_code), v) # define update_tex_family(a,v) tex_word_define(a, internal_int_location(family_code), v) +# define update_tex_variable_family(a,v) tex_word_define(a, internal_int_location(variable_family_code), v) # define update_tex_language(a,v) tex_word_define(a, internal_int_location(language_code), v) # define update_tex_font(a,v) tex_word_define(a, internal_int_location(font_code), v) @@ -1766,4 +1769,14 @@ extern halfword tex_explicit_disc_penalty (halfword mode); # define insert_maxheight(A) dimen_register(A) # define insert_distance(A) skip_register(A) +typedef enum cs_errors { + cs_no_error, + cs_null_error, + cs_below_base_error, + cs_undefined_error, + cs_out_of_range_error, +} cs_errors; + +extern int tex_cs_state(halfword p) ; + # endif diff --git a/source/luametatex/source/tex/texerrors.c b/source/luametatex/source/tex/texerrors.c index bcc581f21..1d1e83dc9 100644 --- a/source/luametatex/source/tex/texerrors.c +++ b/source/luametatex/source/tex/texerrors.c @@ -610,7 +610,7 @@ extern void tex_handle_error(error_types type, const char *format, ...) va_list args; va_start(args, format); /* hm, weird, no number */ tex_aux_start_error(); - tex_print_format_args(format, args); + str = tex_print_format_args(format, args); tex_aux_update_help_text(str); tex_aux_do_handle_error_type(type); va_end(args); diff --git a/source/luametatex/source/tex/texexpand.c b/source/luametatex/source/tex/texexpand.c index a0416d118..e74a9c08d 100644 --- a/source/luametatex/source/tex/texexpand.c +++ b/source/luametatex/source/tex/texexpand.c @@ -528,13 +528,22 @@ void tex_expand_current_token(void) default: /* Maybe ... or maybe an option */ // if (lmt_expand_state.cs_name_level == 0) { - /*tex Complain about an undefined macro */ - tex_handle_error( - normal_error_type, - "Undefined control sequence %m", cur_cs, - "The control sequence at the end of the top line of your error message was never\n" - "\\def'ed. You can just continue as I'll forget about whatever was undefined." - ); + if (tex_cs_state(cur_cs) == cs_undefined_error) { + /*tex Complain about an undefined macro */ + tex_handle_error( + normal_error_type, + "Undefined control sequence %m", cur_cs, + "The control sequence at the end of the top line of your error message was never\n" + "\\def'ed. You can just continue as I'll forget about whatever was undefined." + ); + } else { + /*tex We ended up in a situation that is unlikely to happen in traditional \TEX. */ + tex_handle_error( + normal_error_type, + "Control sequence expected instead of %C", cur_cmd, cur_chr, + "You injected something that confused the parser, maybe by using some Lua call." + ); + } // } break; } @@ -1027,7 +1036,7 @@ static void tex_aux_macro_call(halfword cs, halfword cmd, halfword chr) s = null; goto BAD; } - break; + // break; case thrash_match_token: match = 0; thrash = 1; diff --git a/source/luametatex/source/tex/texfont.c b/source/luametatex/source/tex/texfont.c index 605d6ff75..4aad8f495 100644 --- a/source/luametatex/source/tex/texfont.c +++ b/source/luametatex/source/tex/texfont.c @@ -134,33 +134,18 @@ void tex_undump_font_data(dumpstream f) { lmt_font_state.font_data.ptr = 0; } -void tex_set_charinfo_vertical_parts(charinfo *ci, extinfo *ext) +void tex_set_charinfo_extensible_recipe(charinfo *ci, extinfo *ext) { if (ci->math) { - if (ci->math->vertical_parts) { - extinfo *lst = ci->math->vertical_parts; + extinfo *lst = ci->math->extensible_recipe; + if (lst) { while (lst) { extinfo *c = lst->next; lmt_memory_free(lst); lst = c; } } - ci->math->vertical_parts = ext; - } -} - -void tex_set_charinfo_horizontal_parts(charinfo *ci, extinfo *ext) -{ - if (ci->math) { - if (ci->math->horizontal_parts) { - extinfo *lst = ci->math->horizontal_parts; - while (lst) { - extinfo *c = lst->next; - lmt_memory_free(lst); - lst = c; - } - } - ci->math->horizontal_parts = ext; + ci->math->extensible_recipe = ext; } } @@ -245,8 +230,8 @@ void tex_char_malloc_mathinfo(charinfo *ci) int size = sizeof(mathinfo); mathinfo *mi = lmt_memory_calloc(1, (size_t) size); if (mi) { - mi->horizontal_parts = NULL; - mi->vertical_parts = NULL; + mi->extensible_recipe = NULL; + /* */ mi->top_left_math_kern_array = NULL; mi->top_right_math_kern_array = NULL; mi->bottom_right_math_kern_array = NULL; @@ -256,6 +241,7 @@ void tex_char_malloc_mathinfo(charinfo *ci) mi->top_right_kern = 0; mi->bottom_left_kern = 0; mi->bottom_right_kern = 0; + /* */ mi->left_margin = 0; mi->right_margin = 0; mi->top_margin = 0; @@ -265,8 +251,7 @@ void tex_char_malloc_mathinfo(charinfo *ci) mi->bottom_overshoot = INT_MIN; if (ci->math) { /*tex This seldom or probably never happens. */ - tex_set_charinfo_vertical_parts(ci, NULL); - tex_set_charinfo_horizontal_parts(ci, NULL); + tex_set_charinfo_extensible_recipe(ci, NULL); set_charinfo_top_left_math_kern_array(ci, NULL); set_charinfo_top_right_math_kern_array(ci, NULL); set_charinfo_bottom_right_math_kern_array(ci, NULL); @@ -281,12 +266,19 @@ void tex_char_malloc_mathinfo(charinfo *ci) } } -# define find_charinfo_id(f,c) (sa_get_item_4(lmt_font_state.fonts[f]->characters,c).int_value) +inline int aux_find_charinfo_id(halfword f, int c) +{ + sa_tree_item item; + sa_get_item_4(lmt_font_state.fonts[f]->characters, c, &item); + return (int) item.int_value; +} charinfo *tex_get_charinfo(halfword f, int c) { if (proper_char_index(f, c)) { - int glyph = sa_get_item_4(lmt_font_state.fonts[f]->characters, c).int_value; + sa_tree_item item; + sa_get_item_4(lmt_font_state.fonts[f]->characters, c, &item); + int glyph = (int) item.int_value; if (! glyph) { sa_tree_item sa_value = { 0 }; int tglyph = ++lmt_font_state.fonts[f]->chardata_count; @@ -334,7 +326,7 @@ static charinfo *tex_aux_char_info(halfword f, int c) if (f > lmt_font_state.font_data.ptr) { return NULL; } else if (proper_char_index(f, c)) { - return &(lmt_font_state.fonts[f]->chardata[(int) find_charinfo_id(f, c)]); + return &(lmt_font_state.fonts[f]->chardata[(int) aux_find_charinfo_id(f, c)]); } else if (c == left_boundary_char) { if (font_left_boundary(f)) { return font_left_boundary(f); @@ -363,7 +355,7 @@ int tex_char_exists(halfword f, int c) if (f > lmt_font_state.font_data.ptr) { return 0; } else if (proper_char_index(f, c)) { - return (int) find_charinfo_id(f, c); + return (int) aux_find_charinfo_id(f, c); } else if (c == left_boundary_char) { if (font_has_left_boundary(f)) { return 1; @@ -384,7 +376,7 @@ static int check_math_char(halfword f, int c, int size) if (callback_id > 0) { halfword s = c; lmt_run_callback(lua_state.lua_instance, callback_id, "ddd->d", f, c, size, &s); - if (s && proper_char_index(f, s) && find_charinfo_id(f, s)) { + if (s && proper_char_index(f, s) && aux_find_charinfo_id(f, s)) { return s; } } @@ -405,7 +397,7 @@ int tex_math_char_exists(halfword f, int c, int size) int tex_get_math_char(halfword f, int c, int size, scaled *scale, int direction) { - int id = find_charinfo_id(f, c); + int id = aux_find_charinfo_id(f, c); texfont *tf = lmt_font_state.fonts[f]; if (id) { /* */ @@ -413,7 +405,7 @@ int tex_get_math_char(halfword f, int c, int size, scaled *scale, int direction) charinfo *ci = &tf->chardata[id]; int m = ci->math->mirror; if (m && proper_char_index(f, m)) { - int mid = find_charinfo_id(f, m); + int mid = aux_find_charinfo_id(f, m); if (mid) { id = mid; c = m; @@ -427,7 +419,7 @@ int tex_get_math_char(halfword f, int c, int size, scaled *scale, int direction) if (ci->math) { int s = ci->math->smaller; if (s && proper_char_index(f, s)) { - id = find_charinfo_id(f, s); + id = aux_find_charinfo_id(f, s); if (id) { /* todo: trace */ c = s; @@ -452,58 +444,33 @@ int tex_get_math_char(halfword f, int c, int size, scaled *scale, int direction) return c; } -extinfo *tex_new_charinfo_part(int glyph, int startconnect, int endconnect, int advance, int extender) -{ - int size = sizeof(extinfo); - extinfo *ext = lmt_memory_malloc((size_t) size); - if (ext) { - ext->next = NULL; - ext->glyph = glyph; - ext->start_overlap = startconnect; - ext->end_overlap = endconnect; - ext->advance = advance; - ext->extender = extender; - } else { - tex_overflow_error("font", size); - } - return ext; -} - -void tex_add_charinfo_vertical_part(charinfo *ci, extinfo *ext) -{ - if (ci->math) { - if (ci->math->vertical_parts) { - extinfo *lst = ci->math->vertical_parts; - while (lst->next) - lst = lst->next; - lst->next = ext; - } else { - ci->math->vertical_parts = ext; - } - } -} - -void tex_add_charinfo_horizontal_part(charinfo *ci, extinfo *ext) +void tex_append_charinfo_extensible_recipe(charinfo *ci, int glyph, int startconnect, int endconnect, int advance, int extender) { if (ci->math) { - if (ci->math->horizontal_parts) { - extinfo *lst = ci->math->horizontal_parts; - while (lst->next) { - lst = lst->next; + int size = sizeof(extinfo); + extinfo *ext = lmt_memory_malloc((size_t) size); + if (ext) { + extinfo *lst = ci->math->extensible_recipe; + ext->next = NULL; + ext->glyph = glyph; + ext->start_overlap = startconnect; + ext->end_overlap = endconnect; + ext->advance = advance; + ext->extender = extender; + if (lst) { + while (lst->next) { + lst = lst->next; + } + lst->next = ext; + } else { + ci->math->extensible_recipe = ext; } - lst->next = ext; } else { - ci->math->horizontal_parts = ext; + tex_overflow_error("font", size); } } } -/*tex - - Note that many more small things like this are implemented as macros in the header file. - -*/ - int tex_get_charinfo_math_kerns(charinfo *ci, int id) { /*tex All callers check for |result > 0|. */ @@ -598,43 +565,43 @@ void tex_add_charinfo_math_kern(charinfo *ci, int id, scaled ht, scaled krn) A small complication arises if |rep| is the only non-zero: it needs to be doubled as a non-repeatable to avoid mayhem. -*/ - -void tex_set_charinfo_extensible(charinfo *ci, int top, int bottom, int middle, int extender) -{ - if (ci->math) { - extinfo *ext; - /*tex Clear old data: */ - tex_set_charinfo_vertical_parts(ci, NULL); - if (bottom == 0 && top == 0 && middle == 0 && extender != 0) { - ext = tex_new_charinfo_part(extender, 0, 0, 0, math_extension_normal); - tex_add_charinfo_vertical_part(ci, ext); - ext = tex_new_charinfo_part(extender, 0, 0, 0, math_extension_repeat); - tex_add_charinfo_vertical_part(ci, ext); - } else { - if (bottom) { - ext = tex_new_charinfo_part(bottom, 0, 0, 0, math_extension_normal); - tex_add_charinfo_vertical_part(ci, ext); - } - if (extender) { - ext = tex_new_charinfo_part(extender, 0, 0, 0, math_extension_repeat); - tex_add_charinfo_vertical_part(ci, ext); - } - if (middle) { - ext = tex_new_charinfo_part(middle, 0, 0, 0, math_extension_normal); - tex_add_charinfo_vertical_part(ci, ext); + \starttyping + void tex_set_charinfo_extensible(charinfo *ci, int top, int bottom, int middle, int extender) + { + if (ci->math) { + extinfo *ext; + tex_set_charinfo_extensible_recipe(ci, NULL); + if (bottom == 0 && top == 0 && middle == 0 && extender != 0) { + ext = tex_new_charinfo_extensible_step(extender, 0, 0, 0, math_extension_normal); + tex_add_charinfo_extensible_step(ci, ext); + ext = tex_new_charinfo_extensible_step(extender, 0, 0, 0, math_extension_repeat); + tex_add_charinfo_extensible_step(ci, ext); + } else { + if (bottom) { + ext = tex_new_charinfo_extensible_step(bottom, 0, 0, 0, math_extension_normal); + tex_add_charinfo_extensible_step(ci, ext); + } if (extender) { - ext = tex_new_charinfo_part(extender, 0, 0, 0, math_extension_repeat); - tex_add_charinfo_vertical_part(ci, ext); + ext = tex_new_charinfo_extensible_step(extender, 0, 0, 0, math_extension_repeat); + tex_add_charinfo_extensible_step(ci, ext); + } + if (middle) { + ext = tex_new_charinfo_extensible_step(middle, 0, 0, 0, math_extension_normal); + tex_add_charinfo_extensible_step(ci, ext); + if (extender) { + ext = tex_new_charinfo_extensible_step(extender, 0, 0, 0, math_extension_repeat); + tex_add_charinfo_extensible_step(ci, ext); + } + } + if (top) { + ext = tex_new_charinfo_extensible_step(top, 0, 0, 0, math_extension_normal); + tex_add_charinfo_extensible_step(ci, ext); } - } - if (top) { - ext = tex_new_charinfo_part(top, 0, 0, 0, math_extension_normal); - tex_add_charinfo_vertical_part(ci, ext); } } } -} + \stoptyping +*/ /*tex why not just preallocate for all math otf parameters */ @@ -667,13 +634,12 @@ void tex_delete_font(int f) set_font_left_boundary(f, NULL); set_font_right_boundary(f, NULL); for (int i = font_first_character(f); i <= font_last_character(f); i++) { - if (quick_char_exists(f, i)) { + if (tex_char_exists(f, i)) { charinfo *co = tex_aux_char_info(f, i); set_charinfo_kerns(co, NULL); set_charinfo_ligatures(co, NULL); if (co->math) { - tex_set_charinfo_vertical_parts(co, NULL); - tex_set_charinfo_horizontal_parts(co, NULL); + tex_set_charinfo_extensible_recipe(co, NULL); set_charinfo_top_left_math_kern_array(co, NULL); set_charinfo_top_right_math_kern_array(co, NULL); set_charinfo_bottom_right_math_kern_array(co, NULL); @@ -1119,11 +1085,6 @@ static halfword tex_aux_handle_ligature_nesting(halfword root, halfword cur) have (any kind of) discretionaries. It is still on my agenda to look into nested discretionaries i.e. discs nodes in disc fields but it might never result in useable code. - Remark: there is now a patch for \LUATEX\ that fixes some long pending issue with select discs but - still it's kind of fuzzy. It also complicates the par builder in a way that I don't really want - (at least in \CONTEXT). It was anyway a good reason for removing traces of these special disc nodes - in \LUAMETATEX. - */ static halfword tex_aux_handle_ligature_word(halfword cur) @@ -1327,7 +1288,6 @@ static halfword tex_aux_handle_ligature_word(halfword cur) return cur; } - /*tex The return value is the new tail, head should be a dummy: */ halfword tex_handle_ligaturing(halfword head, halfword tail) @@ -1725,6 +1685,11 @@ scaled tex_char_ef_from_font(halfword f, halfword c) return tex_aux_char_info(f, c)->expansion; } +scaled tex_char_cf_from_font(halfword f, halfword c) +{ + return tex_aux_char_info(f, c)->compression; +} + scaled tex_char_lp_from_font(halfword f, halfword c) { return tex_aux_char_info(f, c)->leftprotrusion; @@ -1737,32 +1702,35 @@ scaled tex_char_rp_from_font(halfword f, halfword c) halfword tex_char_has_tag_from_font(halfword f, halfword c, halfword tag) { - return (charinfo_tag(tex_aux_char_info(f, c)->tagrem) & tag) == tag; + return (tex_aux_char_info(f, c)->tag & tag) == tag; } void tex_char_reset_tag_from_font(halfword f, halfword c, halfword tag) { charinfo *ci = tex_aux_char_info(f, c); - // tag = charinfo_tag(ci->tagrem) & ~(tag | charinfo_tag(ci->tagrem)); - tag = charinfo_tag(ci->tagrem) & ~(tag); - ci->tagrem = charinfo_tagrem(tag,charinfo_rem(ci->tagrem)); - + ci->tag = ci->tag & ~(tag); } halfword tex_char_tag_from_font(halfword f, halfword c) { - return charinfo_tag(tex_aux_char_info(f, c)->tagrem); + return tex_aux_char_info(f, c)->tag; +} + +int tex_char_checked_tag(halfword tag) +{ + return tag & (horizontal_tag | vertical_tag | extend_last_tag | italic_tag | n_ary_tag | radical_tag | punctuation_tag); } -halfword tex_char_remainder_from_font(halfword f, halfword c) +halfword tex_char_next_from_font(halfword f, halfword c) { - return charinfo_rem(tex_aux_char_info(f, c)->tagrem); + charinfo *ci = tex_aux_char_info(f, c); + return ci->math ? ci->math->next : -1; } -halfword tex_char_vertical_italic_from_font(halfword f, halfword c) +halfword tex_char_extensible_italic_from_font(halfword f, halfword c) { charinfo *ci = tex_aux_char_info(f, c); - return ci->math ? ci->math->vertical_italic : INT_MIN; + return ci->math ? ci->math->extensible_italic : INT_MIN; } halfword tex_char_unchecked_top_anchor_from_font(halfword f, halfword c) @@ -1819,16 +1787,10 @@ scaled tex_char_bottom_right_kern_from_font(halfword f, halfword c) return ci->math ? ci->math->bottom_right_kern : 0; } -extinfo *tex_char_vertical_parts_from_font(halfword f, halfword c) -{ - charinfo *ci = tex_aux_char_info(f, c); - return ci->math ? ci->math->vertical_parts : NULL; -} - -extinfo *tex_char_horizontal_parts_from_font(halfword f, halfword c) +extinfo *tex_char_extensible_recipe_from_font(halfword f, halfword c) { charinfo *ci = tex_aux_char_info(f, c); - return ci->math ? ci->math->horizontal_parts : NULL; + return ci->math ? ci->math->extensible_recipe : NULL; } scaled tex_char_left_margin_from_font(halfword f, halfword c) @@ -1867,6 +1829,18 @@ scaled tex_char_bottom_overshoot_from_font(halfword f, halfword c) return ci->math ? ci->math->bottom_overshoot : 0; } +scaled tex_char_inner_x_offset_from_font(halfword f, halfword c) +{ + charinfo *ci = tex_aux_char_info(f, c); + return ci->math ? ci->math->inner_x_offset : 0; +} + +scaled tex_char_inner_y_offset_from_font(halfword f, halfword c) +{ + charinfo *ci = tex_aux_char_info(f, c); + return ci->math ? ci->math->inner_y_offset : 0; +} + /* Nodes */ scaled tex_char_width_from_glyph(halfword g) @@ -1992,6 +1966,13 @@ void tex_set_efcode_in_font(halfword f, halfword c, halfword i) { } } +void tex_set_cfcode_in_font(halfword f, halfword c, halfword i) { + charinfo *ci = tex_aux_char_info(f, c); + if (ci) { + ci->compression = i; + } +} + void tex_set_font_name(halfword f, const char *s) { if (font_name(f)) { diff --git a/source/luametatex/source/tex/texfont.h b/source/luametatex/source/tex/texfont.h index e5365a0be..d3722f9ad 100644 --- a/source/luametatex/source/tex/texfont.h +++ b/source/luametatex/source/tex/texfont.h @@ -72,42 +72,68 @@ typedef struct extinfo { int padding; } extinfo; -// typedef enum math_font_options { -// math_font_ignore_italic_option = 0x01, -// } math_font_options; -// -// # define math_font_option(options,option) ((options & option) == option) +/*tex + We have dedicated fields for hparts and vparts and their italics. Only avery few fonts actually + set the italic on the extensible which is why the engine can use the regular italic, which in + that case is then the last in the variant list because that is where we put the recipe. Keep in + mind that in an \OPENTYPE\ fonts we have a base glyph that has a variant list and part recipe + while in the engine (in good \TEX\ tradition) we chain the variants (with the next field)) so by + the time we arrive at the last one we look at the (h,v) italic there. No fonts (so far) have a + horizontal extensible with a set italic correction. + + Actually, because the specification is rather explicit about glyphs only having horizontal or + vertical extensibles we now have collapsed the two categories into one. +*/ typedef struct mathinfo { - scaled vertical_italic; - scaled top_anchor; /* provided by the font, aka topaccent */ - scaled bottom_anchor; /* provided by context */ - int smaller; - scaled scale; - int flat_accent; /* flac feature code point */ - int top_left_math_kerns; /* size of array */ - int top_right_math_kerns; /* size of array */ - int bottom_right_math_kerns; /* size of array */ - int bottom_left_math_kerns; /* size of array */ - extinfo *horizontal_parts; - extinfo *vertical_parts; - scaled *top_left_math_kern_array; + /*tex + Optional code points for next smaller in size, right2left and flat accent glyphs. + */ + halfword smaller; + halfword mirror; + halfword flat_accent; + halfword next; + /*tex + The top anchor is provides by the font and is also known as topaccent while the bottom + anchor is one set by (in our case) \CONTEXT. + */ + scaled top_anchor; + scaled bottom_anchor; + /*tex + A set of pointers to variable size arrays which is why we also have the number of slots + stored. + */ + int top_left_math_kerns; + int top_right_math_kerns; + int bottom_right_math_kerns; + int bottom_left_math_kerns; + scaled *top_left_math_kern_array; scaled *top_right_math_kern_array; scaled *bottom_right_math_kern_array; scaled *bottom_left_math_kern_array; - /* these are for specific (script) anchoring */ - scaled top_left_kern; - scaled bottom_left_kern; - scaled top_right_kern; - scaled bottom_right_kern; - scaled left_margin; - scaled right_margin; - scaled top_margin; - scaled bottom_margin; - scaled top_overshoot; - scaled bottom_overshoot; - int mirror; - int padding; + /*tex + Here come the extensible recipes. Because we haven't seen both in one glyph we can share + the pointer and put a h/v flag in the tag field. For the moment we keep them both because + we might want to play with a two dimensional extensible some day. + */ + extinfo *extensible_recipe; + scaled extensible_italic; + /*tex These are for specific (script) anchoring. */ + scaled top_left_kern; + scaled bottom_left_kern; + scaled top_right_kern; + scaled bottom_right_kern; + /*tex These four are used in accents. */ + scaled left_margin; + scaled right_margin; + scaled top_margin; + scaled bottom_margin; + /*tex As are the following. */ + scaled top_overshoot; + scaled bottom_overshoot; + /*tex These are for degrees in radicals. */ + scaled inner_x_offset; + scaled inner_y_offset; } mathinfo; typedef struct charinfo { @@ -123,36 +149,59 @@ typedef struct charinfo { /*tex The next three variables relate to expansion and protrusion, properties introduced in the \PDFTEX\ engine. Handling of protrusion and expansion is the only features that we inherit - from this important extension to traditional \TEX. + from this important extension to traditional \TEX. + + We can make the next four into a a pointer which saves on large fonts and only a subset + of characters has protrusion or expansion, if used at all. That way we delegate some memory + consumption to usage (of course allocated blobs also have overhead). */ - scaled expansion; + scaled expansion; + scaled compression; scaled leftprotrusion; scaled rightprotrusion; - /* halfword padding; */ /* when we pack |tag| and |remainder| we can safe 4 bytes */ /*tex - These two are used in a \TFM\ file for signaling ligatures. They are also used for math - extensions in traditional \TEX\ fonts, so we just keep them. + The tag and remainder are used in a \TFM\ file for signaling ligatures. They are also used + for math extensions in traditional \TEX\ fonts. We used to pack the tag and remainder + in an integer: 2 bits is enough for the tag (but we get some more) and the remainder (aka + next) fits in 21 bits. So we had |tagrem| for quite a while. + + But we now use a 32 bit tag field and use proper next field that has been moved to the math + blob so that we can have a compression field here without padding. */ - /* halfword tag; */ /* 2 bits is enough (flags) */ - /* halfword remainder; */ /* 21 bits is enough (unicode) */ - halfword tagrem; /* just an integer, less (arm) alignment hassle that way */ + halfword tag; /*tex Traditional \TEX\ fonts use these two lists for ligature building and inter-character kerning and these are now optional (via pointers). By also using an indirect structure for math data we save quite a bit of memory when we have no math font. + + We could combine math and ligatures and save two slots but then we cannot have a hybrid base + font so ... not now. */ - ligatureinfo *ligatures; kerninfo *kerns; - mathinfo *math; + mathinfo *math; + ligatureinfo *ligatures; } charinfo; +/* + An option is to make this a pointer to a structure but then we also waste a slot. When we + never support it in math then we can actually go smaller: + + charinfo: 8 * 4 : width height depth italic tag *[text or math] *kerns padding + textinfo: 4 * 4 : expansion leftprotrusion rightprotrusion *ligatures + mathinfo: 2 * 4 : next padding ... n * 4 + + But ... given the amount of fields that \CONTEXT\ adds to the basic character data anyway + there is no real reason to spend much time in saving some bytes here. + +*/ + /*tex We can just abuse the token setters and getters here. */ -# define charinfo_tag token_cmd -# define charinfo_rem token_chr -# define charinfo_tagrem token_val +//define charinfo_tag token_cmd +//define charinfo_rem token_chr +//define charinfo_tagrem token_val /*tex @@ -280,10 +329,8 @@ typedef enum text_control_codes { # define has_font_text_control(f,c) ((font_textcontrol(f) & c) == c) /*tex - These are special codes that are used in the traditional ligature builder. In \OPENTYPE\ - fonts we don't see these. - + fonts we don't see these. Maybe this will be dropped at some point. */ typedef enum boundarychar_codes { @@ -292,8 +339,6 @@ typedef enum boundarychar_codes { non_boundary_char = -3, } boundarychar_codes; -/*tex These are pointers, so: |NULL| */ - # define font_left_boundary(a) lmt_font_state.fonts[a]->left_boundary # define font_right_boundary(a) lmt_font_state.fonts[a]->right_boundary @@ -304,12 +349,16 @@ typedef enum boundarychar_codes { # define set_font_right_boundary(a,b) { if (font_right_boundary(a)) { lmt_memory_free(font_right_boundary(a)); } font_right_boundary(a) = b; } /*tex + The math engine can benefit from these properties. For instance we use them for optimizing + the positioning of the degree in a (left) radical. These properties are not stored in the + tag (for a short while we had a variable). +*/ +/*tex In traditional \TEX\ there are just over a handful of font specific parameters for text fonts and some more in math fonts. Actually, these parameters were stored in a way that permitted adding more at runtime, something that made no real sense, but can be abused for creeating more dimensions than the 256 that traditional \TEX\ provides. - */ # define font_parameter_count(a) lmt_font_state.fonts[a]->parameter_count @@ -324,10 +373,8 @@ typedef enum boundarychar_codes { # define set_font_math_parameter_base(a,b) lmt_font_state.fonts[a]->math_parameter_base = b; /*tex - These font parameters could be adapted at runtime but one should really wonder if that is such a good idea nowadays. - */ //define set_font_parameter(f,n,b) { if (font_parameter_count(f) < n) { tex_set_font_parameters(f, n); } font_parameter(f, n) = b; } @@ -346,10 +393,8 @@ extern halfword tex_checked_font_adjust ( ); /*tex - Font parameters are sometimes referred to as |slant(f)|, |space(f)|, etc. These numbers are also the font dimen numbers. - */ typedef enum font_parameter_codes { @@ -372,6 +417,7 @@ extern scaled tex_get_font_extra_space (halfword f); extern scaled tex_get_font_parameter (halfword f, halfword code); extern void tex_set_font_parameter (halfword f, halfword code, scaled v); +extern scaled tex_get_scaled_slant (halfword f); extern scaled tex_get_scaled_space (halfword f); extern scaled tex_get_scaled_space_stretch (halfword f); extern scaled tex_get_scaled_space_shrink (halfword f); @@ -388,9 +434,7 @@ extern halfword tex_get_parameter_glue (quarterword p, quarterword s); extern halfword tex_get_font_identifier (halfword fs); /*tex - The \OPENTYPE\ math fonts have four edges and reference points for kerns. Here we go: - */ typedef enum font_math_kern_codes { @@ -406,17 +450,34 @@ extern void tex_char_process (halfword f, int c); extern int tex_math_char_exists (halfword f, int c, int size); extern int tex_get_math_char (halfword f, int c, int size, scaled *scale, int direction); -/*tex - - Here is a quick way to test if a glyph exists, when you are already certain the font |f| exists, - and that the |c| is a regular glyph id, not one of the two special boundary objects. Contrary - to traditional \TEX\ we store character information in a hash table instead of an array. Keep - in mind that we talk \UNICODE: plenty of characters in the code space, but less so in a font, - so we can best be sparse. +/*tex + These used to be small integers, bit 22 upto 31, but now we have a 32 bit set. We actually don't + really need the granularity but by having these flags we can actually add a bit of control, like + having kerns but still blocking them. The numbers here are no longer reflective of what a tfm + file provides. We assume tfm files to be converted anyway. + Not all are needed but at least we now can keep some state. We can actually use them to something + if we really want to (like when we runt tests). However, that is a rather drastic measure for + shared fonts. Tracing is another application and at some point it will be used for this. */ -# define quick_char_exists(f,c) (sa_get_item_4(lmt_font_state.fonts[f]->characters,c).int_value) +typedef enum char_tag_codes { + no_tag = 0x0000, /*tex vanilla character */ + ligatures_tag = 0x0001, /*tex character has a ligature program, not used */ + kerns_tag = 0x0002, /*tex character has a kerning program, not used */ + list_tag = 0x0004, /*tex character has a successor in a charlist */ + callback_tag = 0x0010, + extensible_tag = 0x0020, /*tex character is extensible, we can unset it in order to block */ + horizontal_tag = 0x0040, /*tex horizontal extensible */ + vertical_tag = 0x0080, /*tex vertical extensible */ + extend_last_tag = 0x0100, /*tex auto scale last variant */ + inner_left_tag = 0x0200, /*tex anchoring */ + inner_right_tag = 0x0400, /*tex anchoring */ + italic_tag = 0x0800, + n_ary_tag = 0x1000, + radical_tag = 0x2000, + punctuation_tag = 0x4000, +} char_tag_codes; /*tex These low level setters are not publis and used in helpers. They might become functions @@ -428,14 +489,15 @@ extern int tex_get_math_char (halfword f, int c, int size, scaled *scal # define set_charinfo_depth(ci,val) ci->depth = val; # define set_charinfo_italic(ci,val) ci->italic = val; # define set_charinfo_expansion(ci,val) ci->expansion = val; +# define set_charinfo_compression(ci,val) ci->compression = val; # define set_charinfo_leftprotrusion(ci,val) ci->leftprotrusion = val; # define set_charinfo_rightprotrusion(ci,val) ci->rightprotrusion = val; -# define set_charinfo_tag(ci,tag) ci->tagrem = charinfo_tagrem(charinfo_tag(ci->tagrem) | tag,charinfo_rem(ci->tagrem)); -# define set_charinfo_remainder(ci,rem) ci->tagrem = charinfo_tagrem(charinfo_tag(ci->tagrem),rem); +# define set_charinfo_tag(ci,val) ci->tag |= val; +# define set_charinfo_next(ci,val) if (ci->math) { ci->math->next = val; } -# define has_charinfo_tag(ci,p) (charinfo_tag(ci->tagrem) & (p) == (p)) -# define get_charinfo_tag(ci) charinfo_tag(ci->tagrem) +# define has_charinfo_tag(ci,p) (ci->tag) & (p) == (p)) +# define get_charinfo_tag(ci) ci->tag # define set_charinfo_ligatures(ci,val) { lmt_memory_free(ci->ligatures); ci->ligatures = val; } # define set_charinfo_kerns(ci,val) { lmt_memory_free(ci->kerns); ci->kerns = val; } @@ -458,11 +520,14 @@ extern int tex_get_math_char (halfword f, int c, int size, scaled *scal # define set_charinfo_smaller(ci,val) if (ci->math) { ci->math->smaller = val; } # define set_charinfo_mirror(ci,val) if (ci->math) { ci->math->mirror = val; } -# define set_charinfo_vertical_italic(ci,val) if (ci->math) { ci->math->vertical_italic = val; } +# define set_charinfo_extensible_italic(ci,val) if (ci->math) { ci->math->extensible_italic = val; } # define set_charinfo_top_anchor(ci,val) if (ci->math) { ci->math->top_anchor = val; } # define set_charinfo_bottom_anchor(ci,val) if (ci->math) { ci->math->bottom_anchor = val; } # define set_charinfo_flat_accent(ci,val) if (ci->math) { ci->math->flat_accent = val; } +# define set_charinfo_inner_x_offset(ci,val) if (ci->math) { ci->math->inner_x_offset = val; } +# define set_charinfo_inner_y_offset(ci,val) if (ci->math) { ci->math->inner_y_offset = val; } + # define set_charinfo_top_left_kern(ci,val) if (ci->math) { ci->math->top_left_kern = val; } # define set_charinfo_top_right_kern(ci,val) if (ci->math) { ci->math->top_right_kern = val; } # define set_charinfo_bottom_left_kern(ci,val) if (ci->math) { ci->math->bottom_left_kern = val; } @@ -476,15 +541,12 @@ extern int tex_get_math_char (halfword f, int c, int size, scaled *scal void tex_set_lpcode_in_font (halfword f, halfword c, halfword i); void tex_set_rpcode_in_font (halfword f, halfword c, halfword i); void tex_set_efcode_in_font (halfword f, halfword c, halfword i); +void tex_set_cfcode_in_font (halfword f, halfword c, halfword i); -extern void tex_set_charinfo_extensible (charinfo *ci, int top, int bottom, int middle, int extender); extern void tex_add_charinfo_math_kern (charinfo *ci, int type, scaled ht, scaled krn); extern int tex_get_charinfo_math_kerns (charinfo *ci, int id); -extern void tex_set_charinfo_horizontal_parts (charinfo *ci, extinfo *ext); -extern void tex_set_charinfo_vertical_parts (charinfo *ci, extinfo *ext); -extern void tex_add_charinfo_vertical_part (charinfo *ci, extinfo *ext); -extern void tex_add_charinfo_horizontal_part (charinfo *ci, extinfo *ext); -extern extinfo *tex_new_charinfo_part (int glyph, int startconnect, int endconnect, int advance, int repeater); +extern void tex_set_charinfo_extensible_recipe (charinfo *ci, extinfo *ext); +extern void tex_append_charinfo_extensible_recipe (charinfo *ci, int glyph, int startconnect, int endconnect, int advance, int repeater); /*tex Checkers: */ @@ -496,63 +558,54 @@ int tex_has_kern (halfword f, halfword c) # define MATH_KERN_NOT_FOUND 0x7FFFFFFF +extern scaled tex_font_x_scaled (scaled v); +extern scaled tex_font_y_scaled (scaled v); + extern scaled tex_char_width_from_font (halfword f, halfword c); /* math + maincontrol */ extern scaled tex_char_height_from_font (halfword f, halfword c); /* math + maincontrol */ extern scaled tex_char_depth_from_font (halfword f, halfword c); /* math + maincontrol */ extern scaled tex_char_total_from_font (halfword f, halfword c); /* math */ +extern scaledwhd tex_char_whd_from_font (halfword f, halfword c); /* math + maincontrol */ extern scaled tex_char_italic_from_font (halfword f, halfword c); /* math + maincontrol */ -// halfword tex_char_options_from_font (halfword f, halfword c); extern scaled tex_char_ef_from_font (halfword f, halfword c); /* packaging + maincontrol */ +extern scaled tex_char_cf_from_font (halfword f, halfword c); /* packaging + maincontrol */ extern scaled tex_char_lp_from_font (halfword f, halfword c); /* packaging + maincontrol */ extern scaled tex_char_rp_from_font (halfword f, halfword c); /* packaging + maincontrol */ extern halfword tex_char_tag_from_font (halfword f, halfword c); /* math */ -extern halfword tex_char_remainder_from_font (halfword f, halfword c); /* math */ +extern halfword tex_char_next_from_font (halfword f, halfword c); /* math */ extern halfword tex_char_has_tag_from_font (halfword f, halfword c, halfword tag); extern void tex_char_reset_tag_from_font (halfword f, halfword c, halfword tag); -// int tex_char_has_option_from_font (halfword g, halfword c, int option); - +extern int tex_char_checked_tag (halfword tag); +extern scaled tex_char_inner_x_offset_from_font (halfword f, halfword c); +extern scaled tex_char_inner_y_offset_from_font (halfword f, halfword c); extern scaled tex_char_top_left_kern_from_font (halfword f, halfword c); /* math */ extern scaled tex_char_top_right_kern_from_font (halfword f, halfword c); /* math */ extern scaled tex_char_bottom_left_kern_from_font (halfword f, halfword c); /* math */ extern scaled tex_char_bottom_right_kern_from_font (halfword f, halfword c); /* math */ - -extern scaledwhd tex_char_whd_from_font (halfword f, halfword c); /* math + maincontrol */ - -extern scaled tex_font_x_scaled (scaled v); -extern scaled tex_font_y_scaled (scaled v); - -extern scaled tex_char_width_from_glyph (halfword g); /* x/y scaled */ -extern scaled tex_char_height_from_glyph (halfword g); /* x/y scaled */ -extern scaled tex_char_depth_from_glyph (halfword g); /* x/y scaled */ -extern scaled tex_char_total_from_glyph (halfword g); /* x/y scaled */ -extern scaled tex_char_italic_from_glyph (halfword g); /* x/y scaled */ -// int tex_char_options_from_glyph (halfword g); -extern scaled tex_char_width_italic_from_glyph (halfword g); /* x/y scaled */ -// int tex_char_has_option_from_glyph (halfword g, int option); - -extern scaledwhd tex_char_whd_from_glyph (halfword g); /* x/y scaled */ - -extern halfword tex_char_unchecked_top_anchor_from_font (halfword f, halfword c); -extern halfword tex_char_unchecked_bottom_anchor_from_font (halfword f, halfword c); - -extern halfword tex_char_vertical_italic_from_font (halfword f, halfword c); +extern halfword tex_char_extensible_italic_from_font (halfword f, halfword c); extern halfword tex_char_flat_accent_from_font (halfword f, halfword c); extern halfword tex_char_top_anchor_from_font (halfword f, halfword c); extern halfword tex_char_bottom_anchor_from_font (halfword f, halfword c); - extern scaled tex_char_left_margin_from_font (halfword f, halfword c); extern scaled tex_char_right_margin_from_font (halfword f, halfword c); extern scaled tex_char_top_margin_from_font (halfword f, halfword c); extern scaled tex_char_bottom_margin_from_font (halfword f, halfword c); - extern scaled tex_char_top_overshoot_from_font (halfword f, halfword c); extern scaled tex_char_bottom_overshoot_from_font (halfword f, halfword c); +extern scaled tex_char_inner_x_offset_from_font (halfword f, halfword c); +extern scaled tex_char_inner_y_offset_from_font (halfword f, halfword c); +extern extinfo *tex_char_extensible_recipe_from_font (halfword f, halfword c); -extern extinfo *tex_char_vertical_parts_from_font (halfword f, halfword c); -extern extinfo *tex_char_horizontal_parts_from_font (halfword f, halfword c); - -/* scaled tex_math_kern_at (halfword f, int c, int side, int v); */ -/* scaled tex_find_math_kern (halfword l_f, int l_c, halfword r_f, int r_c, int cmd, scaled shift); */ +extern halfword tex_char_unchecked_top_anchor_from_font (halfword f, halfword c); +extern halfword tex_char_unchecked_bottom_anchor_from_font (halfword f, halfword c); + +extern scaled tex_char_width_from_glyph (halfword g); /* x/y scaled */ +extern scaled tex_char_height_from_glyph (halfword g); /* x/y scaled */ +extern scaled tex_char_depth_from_glyph (halfword g); /* x/y scaled */ +extern scaled tex_char_total_from_glyph (halfword g); /* x/y scaled */ +extern scaled tex_char_italic_from_glyph (halfword g); /* x/y scaled */ +extern scaled tex_char_width_italic_from_glyph (halfword g); /* x/y scaled */ +extern scaledwhd tex_char_whd_from_glyph (halfword g); /* x/y scaled */ extern int tex_valid_kern (halfword left, halfword right); /* returns kern */ extern int tex_valid_ligature (halfword left, halfword right, int *slot); /* returns type */ @@ -560,7 +613,7 @@ extern int tex_valid_ligature (halfword left, halfword extern scaled tex_calculated_char_width (halfword f, halfword c, halfword ex); extern scaled tex_calculated_glyph_width (halfword g, halfword ex); /* scale */ -/* +/*tex Kerns: the |otherchar| value signals \quote {stop}. These are not really public and only to be used in the helpers. But we keep them as reference. */ @@ -574,7 +627,7 @@ extern scaled tex_calculated_glyph_width (halfword g, halfword ex # define kern_end(b) ((b).adjacent == end_kern) # define kern_disabled(b) ((b).adjacent > end_kern) -/* +/*tex Ligatures: the |otherchar| value signals \quote {stop}. These are not really public and only to be used in the helpers. But we keep them as reference. */ @@ -590,14 +643,14 @@ extern scaled tex_calculated_glyph_width (halfword g, halfword ex # define ligature_end(a) ((a).adjacent == end_of_ligature_code) # define ligature_disabled(a) ((a).adjacent > end_of_ligature_code) -/* Remainders and related flags: */ +/*tex Extension specific: */ typedef enum math_extension_modes { math_extension_normal, math_extension_repeat, } math_extension_modes; -/* Expansion */ +/*tex Expansion and protrusion: */ typedef enum adjust_spacing_modes { adjust_spacing_off, @@ -622,17 +675,6 @@ typedef enum math_extension_locations { } math_extension_locations; */ -/* Tags: */ - -typedef enum tag_codes { - no_tag = 0x00, /*tex vanilla character */ - ligature_tag = 0x01, /*tex character has a ligature/kerning program */ - list_tag = 0x02, /*tex character has a successor in a charlist */ - extension_tag = 0x04, /*tex character is extensible */ - callback_tag = 0x08, - extend_last_tag = 0x10, -} tag_codes; - extern halfword tex_checked_font (halfword f); extern int tex_is_valid_font (halfword f); extern int tex_raw_get_kern (halfword f, int lc, int rc); @@ -641,7 +683,7 @@ extern ligatureinfo tex_get_ligature (halfword f, int lc, int rc); extern int tex_new_font (void); extern int tex_new_font_id (void); extern void tex_font_malloc_charinfo (halfword f, int num); -extern void tex_char_malloc_mathinfo (charinfo * ci); +extern void tex_char_malloc_mathinfo (charinfo *ci); extern void tex_dump_font_data (dumpstream f); extern void tex_undump_font_data (dumpstream f); extern void tex_create_null_font (void); diff --git a/source/luametatex/source/tex/texinputstack.c b/source/luametatex/source/tex/texinputstack.c index 9823fe137..e73451226 100644 --- a/source/luametatex/source/tex/texinputstack.c +++ b/source/luametatex/source/tex/texinputstack.c @@ -392,14 +392,16 @@ static void tex_aux_print_current_input_state(void) } else { switch (lmt_input_state.cur_input.name) { case io_initial_input_code: - tex_print_str("initial"); + tex_print_str("initial input"); break; case io_lua_input_code: - tex_print_str("lua output"); + tex_print_str("lua input"); break; case io_token_input_code: + tex_print_str("token input"); + break; case io_token_eof_input_code: - tex_print_str("scantokens"); + tex_print_str("token eof input"); break; case io_tex_macro_code: case io_file_input_code: @@ -841,11 +843,12 @@ void tex_cleanup_input_state(void) break; case macro_text: { + int ptr, start; /*tex Using a simple version for no arguments has no gain. */ tex_delete_token_reference(lmt_input_state.cur_input.start); /*tex Parameters must be flushed: */ - int ptr = lmt_input_state.parameter_stack_data.ptr; - int start = lmt_input_state.cur_input.parameter_start; + ptr = lmt_input_state.parameter_stack_data.ptr; + start = lmt_input_state.cur_input.parameter_start; while (ptr > start) { --ptr; if (lmt_input_state.parameter_stack[ptr]) { @@ -1063,9 +1066,15 @@ void tex_initialize_inputstack(void) lmt_input_state.align_state = 1000000; } +/*tex + Currently |iotype| can be |io_token_input_code| or |io_token_eof_input_code| but the idea + was to get rid of the eof variant. However, it seems that there are still use cases (not + in \CONTEXT). +*/ + void tex_tex_string_start(int iotype, int cattable) { - (void) iotype; + /* (void) iotype; */ { halfword head = tex_scan_general_text(NULL); int saved_selector = lmt_print_state.selector; @@ -1082,7 +1091,7 @@ void tex_tex_string_start(int iotype, int cattable) lmt_input_state.input_line = 0; lmt_input_state.cur_input.limit = lmt_input_state.cur_input.start; lmt_input_state.cur_input.loc = lmt_input_state.cur_input.limit + 1; - lmt_input_state.cur_input.name = io_token_input_code; + lmt_input_state.cur_input.name = iotype; /* io_token_input_code; */ lmt_cstring_start(); } } diff --git a/source/luametatex/source/tex/texinserts.c b/source/luametatex/source/tex/texinserts.c index 27b979e0f..dbd164926 100644 --- a/source/luametatex/source/tex/texinserts.c +++ b/source/luametatex/source/tex/texinserts.c @@ -424,10 +424,11 @@ void tex_dump_insert_data(dumpstream f) { } void tex_undump_insert_data(dumpstream f) { + insert_record *tmp; undump_int(f, lmt_insert_state.mode); undump_int(f, lmt_insert_state.insert_data.ptr); undump_int(f, lmt_insert_state.insert_data.top); - insert_record *tmp = aux_allocate_clear_array(sizeof(insert_record), lmt_insert_state.insert_data.top, 1); + tmp = aux_allocate_clear_array(sizeof(insert_record), lmt_insert_state.insert_data.top, 1); if (tmp) { lmt_insert_state.inserts = tmp; lmt_insert_state.insert_data.allocated = lmt_insert_state.insert_data.top * sizeof(insert_record); diff --git a/source/luametatex/source/tex/texlanguage.c b/source/luametatex/source/tex/texlanguage.c index 22627ee58..0fcd3b243 100644 --- a/source/luametatex/source/tex/texlanguage.c +++ b/source/luametatex/source/tex/texlanguage.c @@ -525,6 +525,7 @@ void tex_load_hyphenation(struct tex_language *lang, const unsigned char *buff) } } } + lua_pop(L, 1); } } @@ -627,44 +628,6 @@ static char *tex_aux_hyphenation_exception(int exceptions, char *w) return ret; } -/*tex Kept as reference: */ - -/* -char *get_exception_strings(struct tex_language *lang) -{ - char *ret = NULL; - if (lang && lang->exceptions) { - lua_State *L = lua_state.lua_instance; - if (lua_rawgeti(L, LUA_REGISTRYINDEX, lang->exceptions) == LUA_TTABLE) { - size_t size = 0; - size_t current = 0; - lua_pushnil(L); - while (lua_next(L, -2)) { - size_t l = 0; - const char *value = lua_tolstring(L, -1, &l); - if (current + l + 2 > size) { - size_t new = (size + size/5) + current + l + 1024; - char *tmp = lmt_memory_realloc(ret, new); - if (tmp) { - ret = tmp; - size = new; - } else { - overflow_error("exceptions", (int) size); - } - } - if (ret) { - ret[current] = ' '; - strcpy(&ret[current + 1], value); - current += l + 1; - } - lua_pop(L, 1); - } - } - } - return ret; -} -*/ - /*tex The sequence from |wordstart| to |r| can contain only normal characters it could be faster to @@ -997,8 +960,6 @@ static void tex_aux_do_exception(halfword wordstart, halfword r, char *replaceme */ -// # define is_hyphen_char(chr) (get_hc_code(chr) || chr == ex_hyphen_char_par) - inline static halfword tex_aux_is_hyphen_char(halfword chr) { if (tex_get_hc_code(chr)) { @@ -1013,7 +974,6 @@ inline static halfword tex_aux_is_hyphen_char(halfword chr) static halfword tex_aux_find_next_wordstart(halfword r, halfword first_language) { int start_ok = 1; - int mathlevel = 1; halfword lastglyph = r; while (r) { switch (node_type(r)) { @@ -1038,15 +998,18 @@ static halfword tex_aux_find_next_wordstart(halfword r, halfword first_language) start_ok = 1; break; case math_node: - while (mathlevel > 0) { - r = node_next(r); - if (! r) { - return r; - } else if (node_type(r) == math_node) { - if (node_subtype(r) == begin_inline_math) { - mathlevel++; - } else { - mathlevel--; + if (node_subtype(r) == begin_inline_math) { + int mathlevel = 1; + while (mathlevel > 0) { + r = node_next(r); + if (! r) { + return r; + } else if (node_type(r) == math_node) { + if (node_subtype(r) == begin_inline_math) { + mathlevel++; + } else { + mathlevel--; + } } } } diff --git a/source/luametatex/source/tex/texmaincontrol.c b/source/luametatex/source/tex/texmaincontrol.c index 5e0bb2f92..f3d91ffe0 100644 --- a/source/luametatex/source/tex/texmaincontrol.c +++ b/source/luametatex/source/tex/texmaincontrol.c @@ -1594,8 +1594,7 @@ int tex_main_control(void) return cur_chr == dump_code; } } - /*tex not reached */ - return 0; + return 0; /* unreachable */ } /*tex @@ -2242,9 +2241,9 @@ static void tex_aux_run_discretionary(void) case explicit_discretionary_code: /*tex |\-| */ if (hyphenation_permitted(hyphenation_mode_par, explicit_hyphenation_mode)) { + int c = tex_get_pre_hyphen_char(cur_lang_par); halfword d = tex_new_disc_node(explicit_discretionary_code); tex_tail_append(d); - int c = tex_get_pre_hyphen_char(cur_lang_par); if (c > 0) { tex_set_disc_field(d, pre_break_code, tex_new_char_node(glyph_unset_subtype, cur_font_par, c, 1)); } @@ -2259,10 +2258,10 @@ static void tex_aux_run_discretionary(void) case mathematics_discretionary_code: /*tex |-| */ if (hyphenation_permitted(hyphenation_mode_par, automatic_hyphenation_mode)) { + halfword c = tex_get_pre_exhyphen_char(cur_lang_par); halfword d = tex_new_disc_node(automatic_discretionary_code); tex_tail_append(d); /*tex As done in hyphenator: */ - halfword c = tex_get_pre_exhyphen_char(cur_lang_par); if (c <= 0) { c = ex_hyphen_char_par; } @@ -4353,6 +4352,14 @@ static void tex_aux_set_font_property(void) tex_set_efcode_in_font(fnt, chr, val); break; } + case font_cf_code: + { + halfword fnt = tex_scan_font_identifier(NULL); + halfword chr = tex_scan_char_number(0); + halfword val = tex_scan_int(1, NULL); + tex_set_cfcode_in_font(fnt, chr, val); + break; + } case font_dimen_code: { tex_set_font_dimen(); @@ -5958,7 +5965,7 @@ static void tex_aux_run_show_whatever(void) int online = 0; int max = 0; while (1) { - switch (tex_scan_character("ocdnaOCDNA", 0, 0, 0)) { + switch (tex_scan_character("ocdnaOCDNA", 0, 1, 0)) { case 'a': case 'A': if (tex_scan_mandate_keyword("all", 1)) { max = 1; diff --git a/source/luametatex/source/tex/texmarks.c b/source/luametatex/source/tex/texmarks.c index 060c5f579..01e002fbd 100644 --- a/source/luametatex/source/tex/texmarks.c +++ b/source/luametatex/source/tex/texmarks.c @@ -67,12 +67,12 @@ void tex_reset_mark(halfword m) size = m; } if (size <= lmt_mark_state.mark_data.maximum) { - mark_record *tmp = aux_reallocate_array(lmt_mark_state.data, sizeof(mark_record), (size_t) size, 1); + mark_record *tmp = aux_reallocate_array(lmt_mark_state.data, sizeof(mark_record), size, 1); if (tmp) { lmt_mark_state.data = tmp; memset(&lmt_mark_state.data[lmt_mark_state.mark_data.top], 0, sizeof(mark_record) * (size - lmt_mark_state.mark_data.top)); lmt_mark_state.mark_data.top = size; - lmt_mark_state.mark_data.allocated = sizeof(mark_record) * ((size_t) size); + lmt_mark_state.mark_data.allocated = sizeof(mark_record) * size; } else { tex_overflow_error("marks", size); } diff --git a/source/luametatex/source/tex/texmath.c b/source/luametatex/source/tex/texmath.c index 3f452b1ff..f650704cd 100644 --- a/source/luametatex/source/tex/texmath.c +++ b/source/luametatex/source/tex/texmath.c @@ -243,7 +243,6 @@ halfword tex_size_of_style(halfword style) case script_script_style: case cramped_script_script_style: return script_script_size; - break; default: return text_size; } @@ -372,7 +371,9 @@ static void tex_aux_print_fam(const char *what, halfword size, halfword fam) int tex_fam_fnt(int fam, int size) { - return (int) sa_get_item_4(lmt_math_state.fam_head, fam + (256 * size)).int_value; + sa_tree_item item; + sa_get_item_4(lmt_math_state.fam_head, fam + (256 * size), &item); + return (int) item.int_value; } void tex_def_fam_fnt(int fam, int size, int fnt, int level) @@ -413,7 +414,7 @@ void tex_def_math_parameter(int style, int param, scaled value, int level, int i int different = 1; if (level <= 1) { if (math_parameter_value_type(param) == math_muglue_parameter) { - item1 = sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &item2); + sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &item1, &item2); if (item2.int_value == indirect_math_regular && item1.int_value > thick_mu_skip_code) { if (lmt_node_memory_state.nodesizes[item1.int_value]) { tex_free_node(item1.int_value, glue_spec_size); @@ -422,7 +423,7 @@ void tex_def_math_parameter(int style, int param, scaled value, int level, int i } } else { /*tex Less tracing at the cost of a lookup. */ - item1 = sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &item2); + sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &item1, &item2); different = item1.int_value != value || item2.int_value != indirect; } // if (different) { // maybe @@ -440,8 +441,8 @@ void tex_def_math_parameter(int style, int param, scaled value, int level, int i scaled tex_get_math_parameter(int style, int param, halfword *type) { halfword indirect, value; - sa_tree_item v2; - sa_tree_item v1 = sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &v2); + sa_tree_item v1, v2; + sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &v1, &v2); indirect = v2.int_value == lmt_math_state.par_head->dflt.int_value ? indirect_math_unset : v2.uint_value; value = v1.int_value; switch (indirect) { @@ -662,8 +663,8 @@ scaled tex_get_math_parameter(int style, int param, halfword *type) int tex_has_math_parameter(int style, int param) { - sa_tree_item v2; - sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &v2); + sa_tree_item v1, v2; + sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &v1, &v2); return v2.int_value == lmt_math_state.par_head->dflt.int_value ? indirect_math_unset : v2.uint_value; } @@ -675,9 +676,9 @@ static void tex_aux_unsave_math_parameter_data(int gl) if (item.level > 0) { int param = item.code % math_parameter_max_range; int style = item.code / math_parameter_max_range; - sa_tree_item item1, item2; if (math_parameter_value_type(param) == math_muglue_parameter) { - item1 = sa_get_item_8(lmt_math_state.par_head, item.code, &item2); + sa_tree_item item1, item2; + sa_get_item_8(lmt_math_state.par_head, item.code, &item1, &item2); if (item2.int_value == indirect_math_regular && item1.int_value > thick_mu_skip_code) { /* if (tex_valid_node(item1.int_value)) { */ if (lmt_node_memory_state.nodesizes[item1.int_value]) { @@ -788,13 +789,17 @@ halfword tex_new_sub_box(halfword curbox) return noad; } -quarterword tex_aux_set_math_char(halfword target, mathcodeval *mval, mathdictval *dval) +static quarterword tex_aux_set_math_char(halfword target, mathcodeval *mval, mathdictval *dval) { halfword hmcode = tex_get_hm_code(mval->character_value); kernel_math_character(target) = mval->character_value; if (mval->class_value == math_use_current_family_code) { kernel_math_family(target) = cur_fam_par_in_range ? cur_fam_par : mval->family_value; node_subtype(target) = ordinary_noad_subtype; + } else if (mval->family_value == variable_family_par) { + /*tex For CMS chairman MS, so that he can answer a ltx question someplace. */ + kernel_math_family(target) = cur_fam_par_in_range ? cur_fam_par : mval->family_value; + node_subtype(target) = mval->class_value; } else { kernel_math_family(target) = mval->family_value; node_subtype(target) = mval->class_value; @@ -1121,13 +1126,19 @@ static void tex_aux_display_fence_noad(halfword n, int threshold, int max) if (noad_depth(n)) { tex_print_format(", depth %D", noad_depth(n), pt_unit); } - if (get_noad_main_class(n) >= 0) { + if (fence_top_overshoot(n)) { + tex_print_format(", top %D", fence_top_overshoot(n), pt_unit); + } + if (fence_bottom_overshoot(n)) { + tex_print_format(", top %D", fence_bottom_overshoot(n), pt_unit); + } + if (get_noad_main_class(n) != unset_noad_class) { tex_print_format(", class %i", get_noad_main_class(n)); } - if (get_noad_left_class(n) >= 0) { + if (get_noad_left_class(n) != unset_noad_class) { tex_print_format(", leftclass %i", get_noad_left_class(n)); } - if (get_noad_right_class(n) >= 0) { + if (get_noad_right_class(n) != unset_noad_class) { tex_print_format(", rightclass %i", get_noad_right_class(n)); } if (noad_source(n) != 0) { @@ -1976,11 +1987,34 @@ int tex_scan_math_cmd_val(mathcodeval *mval, mathdictval *dval) return 0; } break; - case letter_cmd: - case other_char_cmd: - mval->character_value = cur_chr; + case delimiter_number_cmd: + switch (cur_chr) { + case math_delimiter_code: + *mval = tex_scan_delimiter_as_mathchar(tex_mathcode); + break; + case math_udelimiter_code: + *mval = tex_scan_delimiter_as_mathchar(umath_mathcode); + break; + default: + /* no message yet */ + return 0; + } break; + /*tex + This is/was an experiment but could work out ambigiuous in some cases so when I bring it + back it will be under more strict control. So, for instance a register would make us + enter the default branch but a direct number the other case. In the meantiem we no longer + use the direct char approach (for delimiters mostly) so we can comment it. + */ + // case letter_cmd: + // case other_char_cmd: + // mval->character_value = cur_chr; + // break; default: + /*tex + We could do a fast |tex_scan_something_internal| here but this branch is not that + critical. + */ { halfword n = 0; tex_back_input(cur_tok); @@ -2718,7 +2752,7 @@ void tex_run_math_accent(void) case math_uaccent_code: /*tex |\Umathaccent| */ while (1) { - switch (tex_scan_character("ansfASFN", 0, 0, 0)) { + switch (tex_scan_character("ansfASFN", 0, 1, 0)) { case 'a': case 'A': if (tex_scan_mandate_keyword("attr", 1)) { attrlist = tex_scan_attribute(attrlist); @@ -3707,8 +3741,10 @@ void tex_finish_math_group(void) void tex_run_math_fence(void) { - halfword ht = 0; - halfword dp = 0; + scaled ht = 0; + scaled dp = 0; + scaled top = 0; + scaled bottom = 0; halfword options = 0; halfword mainclass = unset_noad_class; halfword leftclass = unset_noad_class; @@ -3738,19 +3774,9 @@ void tex_run_math_fence(void) } while (1) { /* todo: break down */ - switch (tex_scan_character("hdanlevpcrsuHDANLEVPCRSU", 0, 1, 0)) { + switch (tex_scan_character("hdanlevpcrsutbHDANLEVPCRSUTB", 0, 1, 0)) { case 0: goto CHECK_PAIRING; - case 'h': case 'H': - if (tex_scan_mandate_keyword("height", 1)) { - ht = tex_scan_dimen(0, 0, 0, 0, NULL); - } - break; - case 'd': case 'D': - if (tex_scan_mandate_keyword("depth", 1)) { - dp = tex_scan_dimen(0, 0, 0, 0, NULL); - } - break; case 'a': case 'A': switch (tex_scan_character("uxtUXT", 0, 0, 0)) { case 'u': case 'U': @@ -3773,6 +3799,21 @@ void tex_run_math_fence(void) goto CHECK_PAIRING; } break; + case 'b': case 'B': + if (tex_scan_mandate_keyword("bottom", 1)) { + bottom = tex_scan_dimen(0, 0, 0, 0, NULL); + } + break; + case 'd': case 'D': + if (tex_scan_mandate_keyword("depth", 1)) { + dp = tex_scan_dimen(0, 0, 0, 0, NULL); + } + break; + case 'h': case 'H': + if (tex_scan_mandate_keyword("height", 1)) { + ht = tex_scan_dimen(0, 0, 0, 0, NULL); + } + break; case 'n': case 'N': switch (tex_scan_character("oO", 0, 0, 0)) { case 'o': case 'O': @@ -3863,6 +3904,11 @@ void tex_run_math_fence(void) source = tex_scan_int(0, NULL); } break; + case 't': case 'T': + if (tex_scan_mandate_keyword("top", 1)) { + top = tex_scan_dimen(0, 0, 0, 0, NULL); + } + break; default: goto CHECK_PAIRING; } @@ -3930,6 +3976,9 @@ void tex_run_math_fence(void) } noad_italic(fence) = 0; noad_source(fence) = source; + /* */ + fence_top_overshoot(fence) = top; + fence_bottom_overshoot(fence) = bottom; /*tex By setting this here, we can get rid of the hard coded values in |mlist_to_hlist| which sort of interfere (or at least confuse) things there. When set, the |leftclass| and @@ -4643,6 +4692,27 @@ static void tex_aux_define_dis_math_parameters(int size, int param, scaled value } } +/*tex + In principle we could save some storage in the format file with: + + \starttyping + static void tex_aux_define_all_math_parameters(int size, int param, scaled value, int level) + { + tex_def_math_parameter(all_math_styles, param, value, level, indirect_math_regular); + } + \stoptyping + + and then do this (we also need to move |all_math_styles| up in the enum to keep ranges compact): + + \starttyping + if (! sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * style)), &item1, &item2)) { + sa_get_item_8(lmt_math_state.par_head, (param + (math_parameter_max_range * all_math_styles)), &item1, &item2); + } + \stoptyping + + but in practice we actually get a bit larger file. +*/ + static void tex_aux_define_all_math_parameters(int size, int param, scaled value, int level) { switch (size) { @@ -4756,7 +4826,7 @@ inline static scaled tex_aux_get_font_math_quantity(scaled scale, halfword v) /*tex The next function is called when we define a family, but first we define a few helpers - for identifying traditional math fonts. Watch the hard codes family check! + for identifying traditional math fonts. Watch the hard codes family check (gone now)! */ void tex_fixup_math_parameters(int fam, int size, int f, int level) diff --git a/source/luametatex/source/tex/texmath.h b/source/luametatex/source/tex/texmath.h index cc7aa7e7f..b97b1e8f2 100644 --- a/source/luametatex/source/tex/texmath.h +++ b/source/luametatex/source/tex/texmath.h @@ -663,20 +663,22 @@ typedef enum math_control_codes { math_control_accent_skew_apply = 0x000040, math_control_apply_ordinary_kern_pair = 0x000080, math_control_apply_vertical_italic_kern = 0x000100, - math_control_apply_ordinary_italic_kern = 0x000200, - math_control_apply_char_italic_kern = 0x000400, /* traditional */ - math_control_rebox_char_italic_kern = 0x000800, /* traditional */ - math_control_apply_boxed_italic_kern = 0x001000, - math_control_staircase_kern = 0x002000, - math_control_apply_text_italic_kern = 0x004000, - math_control_check_text_italic_kern = 0x008000, - math_control_check_space_italic_kern = 0x010000, - math_control_apply_script_italic_kern = 0x020000, - math_control_analyze_script_nucleus_char = 0x040000, - math_control_analyze_script_nucleus_list = 0x080000, - math_control_analyze_script_nucleus_box = 0x100000, - math_control_accent_top_skew_with_offset = 0x200000, - math_control_ignore_kern_dimensions = 0x400000, /* for bad fonts (like xits fence depths) */ + math_control_apply_ordinary_italic_kern = 0x0000200, + math_control_apply_char_italic_kern = 0x0000400, /* traditional */ + math_control_rebox_char_italic_kern = 0x0000800, /* traditional */ + math_control_apply_boxed_italic_kern = 0x0001000, + math_control_staircase_kern = 0x0002000, + math_control_apply_text_italic_kern = 0x0004000, + math_control_check_text_italic_kern = 0x0008000, + math_control_check_space_italic_kern = 0x0010000, + math_control_apply_script_italic_kern = 0x0020000, + math_control_analyze_script_nucleus_char = 0x0040000, + math_control_analyze_script_nucleus_list = 0x0080000, + math_control_analyze_script_nucleus_box = 0x0100000, + math_control_accent_top_skew_with_offset = 0x0200000, + math_control_ignore_kern_dimensions = 0x0400000, /* for bad fonts (like xits fence depths) */ + math_control_ignore_flat_accents = 0x0800000, + math_control_extend_accents = 0x1000000, } math_control_codes; /*tex This is what we use for \OPENTYPE\ in \CONTEXT: */ diff --git a/source/luametatex/source/tex/texmathcodes.c b/source/luametatex/source/tex/texmathcodes.c index 545013264..f19cde91c 100644 --- a/source/luametatex/source/tex/texmathcodes.c +++ b/source/luametatex/source/tex/texmathcodes.c @@ -164,8 +164,9 @@ void tex_set_math_code(int n, mathcodeval v, int level) mathcodeval tex_get_math_code(int n) { - sa_tree_item item = sa_get_item_4(lmt_mathcode_state.mathcode_head, n); + sa_tree_item item; mathcodeval m = { 0, 0, 0 }; + sa_get_item_4(lmt_mathcode_state.mathcode_head, n, &item); if (item.uint_value == MATHCODEDEFAULT) { m.character_value = n; } else if (item.uint_value == MATHCODEACTIVE) { @@ -267,9 +268,9 @@ delcodeval tex_no_del_code(void) delcodeval tex_get_del_code(int n) { - sa_tree_item v2; - sa_tree_item v1 = sa_get_item_8(lmt_mathcode_state.delcode_head, n, &v2); + sa_tree_item v1, v2; delcodeval d = { { 0, -1, 0 }, { 0, 0, 0} }; + sa_get_item_8(lmt_mathcode_state.delcode_head, n, &v1, &v2); if (v1.uint_value != DELCODEDEFAULT) { d.small.class_value = (short) v1.math_code_value.class_value; d.small.family_value = (short) v1.math_code_value.family_value; diff --git a/source/luametatex/source/tex/texmlist.c b/source/luametatex/source/tex/texmlist.c index ddc3f0a6e..0ea1f82e8 100644 --- a/source/luametatex/source/tex/texmlist.c +++ b/source/luametatex/source/tex/texmlist.c @@ -178,7 +178,8 @@ static void tex_aux_prepend_hkern_to_box_list(halfword q, scaled delta, halfword \startitem |FlattenedAccentBaseHeight|: This is based on the |flac| |GSUB| feature. It would not be hard to support that, but proper math accent placements cf.\ |MATH| needs support - for |MathTopAccentAttachment| table to be implemented first. + for |MathTopAccentAttachment| table to be implemented first. We actually do support + it in \LUAMETATEX. \stopitem \stopitemize @@ -188,10 +189,10 @@ static void tex_aux_prepend_hkern_to_box_list(halfword q, scaled delta, halfword Occasionally I visit this file and make some variables more verbose. - In the meantime some experimental and in the meantime obsolete code has been removed but it can - be found in the development repository if really needed. It makes no sense to keep code around - that has been replaced or improved otherwise. Some code we keep commented for a while before it - is flushed out. + In the meantime some experimental and obsolete code has been removed but it can be found in + the development repository if really needed. It makes no sense to keep code around that has + been replaced or improved otherwise. Some code we keep commented for a while before it is + flushed out. */ @@ -297,7 +298,7 @@ inline static void tex_aux_make_style(halfword current, halfword *current_style, } tex_aux_set_current_math_size(style); if (current_mu) { - *current_mu = scaledround(tex_get_math_quad_style(style) / 18.0); + *current_mu = scaledround((double) tex_get_math_quad_style(style) / 18.0); } } break; @@ -311,7 +312,7 @@ void tex_set_math_text_font(halfword style, int usetextfont) halfword scale = tex_get_math_font_scale(font, size); switch (usetextfont) { case math_atom_text_font_option: - scale = scaledround((double) scale * lmt_font_state.fonts[font]->size / lmt_font_state.fonts[cur_font_par]->size); + scale = scaledround((double) scale * (double) lmt_font_state.fonts[font]->size / (double) lmt_font_state.fonts[cur_font_par]->size); break; case math_atom_math_font_option: update_tex_font(0, font); @@ -858,11 +859,13 @@ static halfword tex_aux_char_box(halfword fnt, int chr, halfword att, scaled *ic } else if (ic) { *ic = 0; } - if (target && whd.wd < target && tex_char_has_tag_from_font(fnt, chr, extend_last_tag)) { + if (target && whd.wd > 0 && whd.wd < target && tex_aux_math_engine_control(fnt, math_control_extend_accents) && tex_char_has_tag_from_font(fnt, chr, extend_last_tag)) { scaled margin = tex_get_math_x_parameter_default(style, math_parameter_accent_extend_margin, 0); scaled amount = target - 2 * margin; - glyph_x_scale(glyph) = lround((double) glyph_x_scale(glyph) * amount/whd.wd); - glyph_x_offset(glyph) = (whd.wd - amount)/2; + if (amount > 0) { + glyph_x_scale(glyph) = lround((double) glyph_x_scale(glyph) * amount/whd.wd); + glyph_x_offset(glyph) = (whd.wd - amount)/2; + } } return box; } @@ -1016,7 +1019,6 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m scaled max_natural = 0; /*tex amount of possible shrink in the stack */ scaled max_shrink = 0; - extinfo *extensible = NULL; scaled overlap; /*tex a temporary counter number of extensible pieces */ int pieces = 0; @@ -1026,15 +1028,10 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m int with_extenders = -1; int n_of_extenders = 0; int n_of_normal = 0; + extinfo *extensible = tex_char_extensible_recipe_from_font(fnt, chr); if (minoverlap < 0) { minoverlap = 0; } - /* chr = math_char_exists(fnt, chr, math_state.size); */ - if (horizontal) { - extensible = tex_char_horizontal_parts_from_font(fnt, chr); - } else { - extensible = tex_char_vertical_parts_from_font(fnt, chr); - } tex_attach_attribute_list_attribute(box, att); for (extinfo *e = extensible; e; e = e->next) { if (! tex_char_exists(fnt, e->glyph)) { @@ -1135,13 +1132,13 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m if (overlap < initial) { initial = overlap; } - if (advance == 0) { - /*tex for tfm fonts (so no need for scaling) */ - advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */ + // if (advance == 0) { + // /*tex for tfm fonts (so no need for scaling) */ + // advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */ if (advance <= 0) { tex_formatted_error("fonts", "bad horizontal extensible character %i in font %i", chr, fnt); } - } + // } max_natural += advance - initial; overlap = tex_aux_math_x_size_scaled(fnt, e->end_overlap, size); } else { @@ -1155,13 +1152,13 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m if (overlap < initial) { initial = overlap; } - if (advance == 0) { - /*tex for tfm fonts (so no need for scaling) */ - advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */ + // if (advance == 0) { + // /*tex for tfm fonts (so no need for scaling) */ + // advance = tex_aux_math_x_size_scaled(fnt, tex_char_width_from_font(fnt, e->glyph), size); /* todo: combine */ if (advance <= 0) { tex_formatted_error("fonts", "bad horizontal extensible character %i in font %i", chr, fnt); } - } + // } max_natural += advance - initial; overlap = tex_aux_math_x_size_scaled(fnt, e->end_overlap, size); pieces--; @@ -1179,12 +1176,12 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m if (overlap < initial) { initial = overlap; } - if (advance == 0) { - advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */ + // if (advance == 0) { + // advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */ if (advance <= 0) { tex_formatted_error("fonts", "bad vertical extensible character %i in font %i", chr, fnt); } - } + // } max_natural += advance - initial; overlap = tex_aux_math_y_size_scaled(fnt, e->end_overlap, size); } else { @@ -1198,12 +1195,12 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m if (overlap < initial) { initial = overlap; } - if (advance == 0) { - advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */ + // if (advance == 0) { + // advance = tex_aux_math_y_size_scaled(fnt, tex_char_total_from_font(fnt, e->glyph), size); /* todo: combine */ if (advance <= 0) { tex_formatted_error("fonts", "bad vertical extensible character %i in font %i", chr, fnt); } - } + // } max_natural += advance - initial; overlap = tex_aux_math_y_size_scaled(fnt, e->end_overlap, size); pieces--; @@ -1263,15 +1260,37 @@ halfword tex_make_extensible(halfword fnt, halfword chr, scaled target, scaled m } /*tex Set glue so as to stretch the connections if needed. */ if (target > max_natural && max_shrink > 0) { - scaled delta = target - max_natural; - /*tex Don't stretch more than |s_max|. */ - if (delta > max_shrink) { - delta = max_shrink; - } - box_glue_order(box) = normal_glue_order; - box_glue_sign(box) = stretching_glue_sign; - box_glue_set(box) = (glueratio) (delta / (glueratio) max_shrink); - max_natural += delta; + // if (1) { + // halfword b; + // if (horizontal) { + // b = tex_hpack(box_list(box), target, packing_exactly, (singleword) math_direction_par, holding_none_option); + // } else { + // b = tex_vpack(box_list(box), target, packing_exactly, max_dimen, (singleword) math_direction_par, holding_none_option); + // } + // box_glue_order(box) = box_glue_order(b); + // box_glue_sign(box) = box_glue_sign(b); + // box_glue_set(box) = box_glue_set(b); + // box_list(b) = null; + // tex_flush_node(b); + // max_natural = target; + // } else { + scaled delta = target - max_natural; + /*tex Don't stretch more than |s_max|. */ + if (delta > max_shrink) { + if (tracing_math_par >= 1) { + tex_begin_diagnostic(); + tex_print_format("[math: extensible clipped, target %D, natural %D, shrink %D, clip %D]", + target, pt_unit, max_natural, pt_unit, max_shrink, pt_unit, delta - max_shrink, pt_unit + ); + tex_end_diagnostic(); + } + delta = max_shrink; + } + box_glue_order(box) = normal_glue_order; + box_glue_sign(box) = stretching_glue_sign; + box_glue_set(box) = (glueratio) (delta / (glueratio) max_shrink); + max_natural += delta; + // } } if (horizontal) { box_width(box) = max_natural; @@ -1402,7 +1421,7 @@ static halfword tex_aux_make_delimiter(halfword target, halfword delimiter, int goto FOUND; } } - if (tex_char_has_tag_from_font(curfnt, curchr, extension_tag)) { + if (tex_char_has_tag_from_font(curfnt, curchr, extensible_tag)) { fnt = curfnt; chr = curchr; do_parts = 1; @@ -1413,7 +1432,7 @@ static halfword tex_aux_make_delimiter(halfword target, halfword delimiter, int } else if (tex_char_has_tag_from_font(curfnt, curchr, list_tag)) { prvfnt = curfnt; prvchr = curchr; - curchr = tex_char_remainder_from_font(curfnt, curchr); + curchr = tex_char_next_from_font(curfnt, curchr); goto CONTINUE; } } @@ -1444,17 +1463,14 @@ static halfword tex_aux_make_delimiter(halfword target, halfword delimiter, int When the following code is executed, |do_parts| will be true if a built-up symbol is supposed to be returned. */ - extinfo *ext = NULL; - if (do_parts) { - /* tex_char_process(fnt, chr); */ /* in case we realloc */ - ext = flat ? tex_char_horizontal_parts_from_font(fnt, chr) : tex_char_vertical_parts_from_font(fnt, chr); - } + extinfo *ext = do_parts ? tex_char_extensible_recipe_from_font(fnt, chr) : NULL; if (ext) { scaled minoverlap = flat ? tex_get_math_x_parameter_default(style, math_parameter_connector_overlap_min, 0) : tex_get_math_y_parameter_default(style, math_parameter_connector_overlap_min, 0);; result = tex_aux_get_delimiter_box(fnt, chr, targetsize, minoverlap, flat, att); if (delta) { + /*tex Not yet done: horizontal italics. */ if (tex_aux_math_engine_control(fnt, math_control_apply_vertical_italic_kern)) { - *delta = tex_aux_math_x_size_scaled(fnt, tex_char_vertical_italic_from_font(fnt, nxtchr), size); + *delta = tex_aux_math_x_size_scaled(fnt, tex_char_extensible_italic_from_font(fnt, nxtchr), size); } else { *delta = tex_aux_math_x_size_scaled(fnt, tex_char_italic_from_font(fnt, nxtchr), size); } @@ -2303,6 +2319,8 @@ static void tex_aux_make_root_radical(halfword target, int style, int size, kern halfword companion = leftdelimiter ? rightdelimiter : null; halfword radical = null; delimiterextremes extremes = { .tfont = null_font, .tchar = 0, .bfont = null_font, .bchar = 0, .height = 0, .depth = 0 }; + scaled innerx = INT_MIN; + scaled innery = INT_MIN; noad_new_hlist(target) = null; /*tex We can take the rule width from the fam/style of the delimiter or use the most recent math @@ -2321,6 +2339,15 @@ static void tex_aux_make_root_radical(halfword target, int style, int size, kern theta = tex_get_math_y_parameter_checked(style, math_parameter_fraction_rule); /* a bit weird this one */ } delimiter = tex_aux_make_delimiter(target, delimiter, size, box_total(nucleus) + clearance + theta, 0, style, 1, NULL, NULL, 0, has_noad_option_nooverflow(target), &extremes, 0); + if (radical_degree(target)) { + if (tex_char_has_tag_from_font(extremes.bfont, extremes.bchar, inner_left_tag)) { + innerx = tex_char_inner_x_offset_from_font(extremes.bfont, extremes.bchar); + innery = tex_char_inner_y_offset_from_font(extremes.bfont, extremes.bchar); + } else if (tex_char_has_tag_from_font(extremes.tfont, extremes.tchar, inner_left_tag)) { + innerx = tex_char_inner_x_offset_from_font(extremes.tfont, extremes.tchar); + innery = tex_char_inner_y_offset_from_font(extremes.tfont, extremes.tchar); + } + } if (companion) { /*tex For now we assume symmetry and same height and depth! */ companion = tex_aux_make_delimiter(target, companion, size, box_total(nucleus) + clearance + theta, 0, style, 1, NULL, NULL, 0, has_noad_option_nooverflow(target), &extremes, 0); @@ -2385,6 +2412,10 @@ static void tex_aux_make_root_radical(halfword target, int style, int size, kern scaled before = tex_get_math_x_parameter_checked(style, math_parameter_radical_degree_before); scaled after = tex_get_math_x_parameter_checked(style, math_parameter_radical_degree_after); scaled raise = tex_get_math_parameter_checked(style, math_parameter_radical_degree_raise); + if (innerx != INT_MIN) { + tex_aux_append_hkern_to_box_list(degree, innerx, horizontal_math_kern_subtype, "bad degree"); + width += innerx; + } if (-after > width) { before += -after - width; } @@ -2396,7 +2427,11 @@ static void tex_aux_make_root_radical(halfword target, int style, int size, kern } else { nucleus = radical; } - box_shift_amount(degree) = - (tex_xn_over_d(total, raise, 100) - box_depth(radical) - box_shift_amount(radical)); + if (innery != INT_MIN) { + box_shift_amount(degree) = - innery + box_depth(radical) + box_shift_amount(radical); + } else { + box_shift_amount(degree) = - (tex_xn_over_d(total, raise, 100) - box_depth(radical) - box_shift_amount(radical)); + } tex_couple_nodes(degree, nucleus); if (before) { halfword kern = tex_new_kern_node(before, horizontal_math_kern_subtype); @@ -2876,8 +2911,8 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal target = tex_xn_over_d(target, fraction, 1000); } while (1) { - if (tex_char_has_tag_from_font(accentfnt, accentchr, extension_tag)) { - extended = tex_char_horizontal_parts_from_font(accentfnt, accentchr); + if (tex_char_has_tag_from_font(accentfnt, accentchr, extensible_tag)) { + extended = tex_char_extensible_recipe_from_font(accentfnt, accentchr); } if (extended) { /*tex @@ -2891,19 +2926,19 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal } else if (! tex_char_has_tag_from_font(accentfnt, accentchr, list_tag)) { break; } else { - halfword remainder = tex_char_remainder_from_font(accentfnt, accentchr); - if (! tex_char_exists(accentfnt, remainder)) { + halfword next = tex_char_next_from_font(accentfnt, accentchr); + if (! tex_char_exists(accentfnt, next)) { break; } else if (flags & overlay_accent_code) { - if (tex_aux_math_y_size_scaled(accentfnt, tex_char_height_from_font(accentfnt, remainder), size) > target) { + if (tex_aux_math_y_size_scaled(accentfnt, tex_char_height_from_font(accentfnt, next), size) > target) { break; } } else { - if (tex_aux_math_x_size_scaled(accentfnt, tex_char_width_from_font(accentfnt, remainder), size) > target) { + if (tex_aux_math_x_size_scaled(accentfnt, tex_char_width_from_font(accentfnt, next), size) > target) { break; } } - accentchr = remainder; + accentchr = next; } } /*tex @@ -2914,24 +2949,23 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal /*tex Italic gets added to width for traditional fonts (no italic anyway): */ accent = tex_aux_char_box(accentfnt, accentchr, attrlist, NULL, glyph_math_accent_subtype, basewidth, style); // usedwidth } - if (accenttotal) { - *accenttotal = box_total(accent); - } if (flags & top_accent_code) { scaled b = tex_get_math_y_parameter(style, math_parameter_accent_base_height); - scaled f = tex_get_math_y_parameter(style, math_parameter_flattened_accent_base_height); scaled u = tex_get_math_y_parameter(style, stretch ? math_parameter_flattened_accent_top_shift_up : math_parameter_accent_top_shift_up); - if (f != undefined_math_parameter && baseheight > f) { - halfword flatchr = tex_char_flat_accent_from_font(accentfnt, accentchr); - if (flatchr != INT_MIN && flatchr != accentchr) { - tex_flush_node(accent); - accent = tex_aux_char_box(accentfnt, flatchr, attrlist, NULL, glyph_math_accent_subtype, usedwidth, style); - if (tracing_math_par >= 2) { - tex_begin_diagnostic(); - tex_print_format("[math: flattening accent, old %x, new %x]", accentchr, flatchr); - tex_end_diagnostic(); + if (! tex_aux_math_engine_control(accentfnt, math_control_ignore_flat_accents)) { + scaled f = tex_get_math_y_parameter(style, math_parameter_flattened_accent_base_height); + if (f != undefined_math_parameter && baseheight > f) { + halfword flatchr = tex_char_flat_accent_from_font(accentfnt, accentchr); + if (flatchr != INT_MIN && flatchr != accentchr) { + tex_flush_node(accent); + accent = tex_aux_char_box(accentfnt, flatchr, attrlist, NULL, glyph_math_accent_subtype, usedwidth, style); + if (tracing_math_par >= 2) { + tex_begin_diagnostic(); + tex_print_format("[math: flattening accent, old %x, new %x]", accentchr, flatchr); + tex_end_diagnostic(); + } + accentchr = flatchr; } - accentchr = flatchr; } } if (b != undefined_math_parameter) { @@ -2956,6 +2990,9 @@ static void tex_aux_do_make_math_accent(halfword target, halfword accentfnt, hal /*tex Center the accent vertically around base: */ delta = tex_half_scaled(box_total(accent) + box_total(base)); } + if (accenttotal) { + *accenttotal = box_total(accent); + } if (node_type(nucleus) != math_char_node) { /*tex We have a molecule, not a simple atom. */ } else if (noad_has_following_scripts(target)) { @@ -3151,11 +3188,11 @@ static void tex_aux_wrap_fraction_result(halfword target, int style, int size, h halfword left = null; halfword right = null; halfword delta = tex_get_math_y_parameter(style, math_parameter_fraction_del_size); + delimiterextremes extremes = { .tfont = null_font, .tchar = 0, .bfont = null_font, .bchar = 0, .height = 0, .depth = 0 }; if (delta == undefined_math_parameter) { delta = tex_aux_get_delimiter_height(box_height(fraction), box_depth(fraction), 1, size, style); } /*tex Watch out: there can be empty delimiter boxes but with width. */ - delimiterextremes extremes = { .tfont = null_font, .tchar = 0, .bfont = null_font, .bchar = 0, .height = 0, .depth = 0 }; left = tex_aux_make_delimiter(target, left_delimiter, size, delta, 0, style, 1, NULL, NULL, 0, has_noad_option_nooverflow(target), NULL, 0); right = tex_aux_make_delimiter(target, right_delimiter, size, delta, 0, style, 1, NULL, NULL, 0, has_noad_option_nooverflow(target), &extremes, 0); if (kerns && extremes.tfont) { @@ -3895,9 +3932,9 @@ static scaled tex_aux_op_wrapup(halfword target, int style, int size, int italic } */ while (tex_char_has_tag_from_font(fnt, chr, list_tag) && tex_char_total_from_font(fnt, chr) < opsize) { - halfword rem = tex_char_remainder_from_font(fnt, chr); - if (chr != rem && tex_char_exists(fnt, rem)) { - chr = rem; + halfword next = tex_char_next_from_font(fnt, chr); + if (chr != next && tex_char_exists(fnt, next)) { + chr = next; kernel_math_character(noad_nucleus(target)) = chr; } else { break; @@ -4054,11 +4091,11 @@ static halfword tex_aux_check_ord(halfword current, halfword size, halfword next } case math_char_node: { + halfword curchr = null; + halfword curfnt = null; if (! next) { next = node_next(current); } - halfword curchr = null; - halfword curfnt = null; tex_aux_fetch(nucleus, "ordinal", &curfnt, &curchr); if (curfnt && curchr) { halfword kern = 0; @@ -4439,7 +4476,6 @@ static scaled tex_aux_math_kern_at(halfword fnt, int chr, int side, int value) return tex_char_top_left_kern_from_font(fnt, chr); case bottom_left_kern: return tex_char_bottom_left_kern_from_font(fnt, chr); - break; case top_right_kern: return tex_char_top_right_kern_from_font(fnt, chr); case bottom_right_kern: @@ -5336,6 +5372,22 @@ static void tex_aux_make_scripts(halfword target, halfword kernel, scaled italic */ +// static inline int tex_aux_is_extensible(halfword result) +// { +// if (result) { +// switch (node_type(result)) { +// case hlist_node: +// case vlist_node: +// switch (node_subtype(result)) { +// case math_h_delimiter_list: +// case math_v_delimiter_list: +// return 1; +// } +// } +// } +// return 0; +// } + static halfword tex_aux_make_left_right(halfword target, int style, scaled max_d, scaled max_h, int size, delimiterextremes *extremes) { halfword tmp; @@ -5347,6 +5399,8 @@ static halfword tex_aux_make_left_right(halfword target, int style, scaled max_d scaled height = tex_aux_math_given_y_scaled(noad_height(target)); scaled depth = tex_aux_math_given_y_scaled(noad_depth(target)); int leftoperator = node_type(target) == fence_noad && node_subtype(target) == left_operator_side; + max_h += fence_top_overshoot(target); + max_d += fence_bottom_overshoot(target); if (extremes) { extremes->tfont = null_font; extremes->bfont = null_font; @@ -5365,6 +5419,15 @@ static halfword tex_aux_make_left_right(halfword target, int style, scaled max_d /*tex Beware, a stacked delimiter has a shift but no corrected height/depth (yet). */ +/* or do we need has_noad_option_check(target) */ +if (! stack && has_noad_option_exact(target)) { + if (extremes && extremes->height < height) { + height = extremes->height; + } + if (extremes && extremes->depth < depth) { + depth = extremes->depth; + } +} if (stack) { box_shift_amount(tmp) = depth; } @@ -5373,10 +5436,15 @@ static halfword tex_aux_make_left_right(halfword target, int style, scaled max_d depth = box_depth(tmp) + box_shift_amount(tmp); } if (has_noad_option_axis(target)) { - halfword axis = tex_aux_math_axis(size); - height += axis; - depth -= axis; - box_shift_amount(tmp) -= axis; + // if (has_noad_option_noaxis(target) && tex_aux_is_extensible(tmp)) { + if (has_noad_option_noaxis(target) && stack) { + /*tex A sort of special case: see sized integrals in ctx examples. */ + } else { + halfword axis = tex_aux_math_axis(size); + height += axis; + depth -= axis; + box_shift_amount(tmp) -= axis; + } } lst = tex_new_node(hlist_node, 0); tex_attach_attribute_list_copy(lst, target); @@ -5392,7 +5460,7 @@ static halfword tex_aux_make_left_right(halfword target, int style, scaled max_d if (leftoperator && has_noad_option_auto(target)) { /*tex Todo: option for skipping this. */ if (style < text_style) { - scaled s = scaledround(tex_get_math_parameter(style, math_parameter_operator_size, NULL)); + scaled s = scaledround((double) tex_get_math_parameter(style, math_parameter_operator_size, NULL)); if (s > max_h + max_d) { max_h = scaledround(s / 2.0); max_d = max_h; @@ -5703,6 +5771,7 @@ static halfword tex_aux_check_nucleus_complexity(halfword target, scaled *italic halfword fnt = null; if (tex_aux_fetch(nucleus, "(text) char", &fnt, &chr)) { /*tex We make a math glyph from an ordinary one. */ + halfword glyph; quarterword subtype = 0; switch (node_subtype(nucleus)) { case ordinary_noad_subtype: subtype = glyph_math_ordinary_subtype; break; @@ -5736,7 +5805,7 @@ static halfword tex_aux_check_nucleus_complexity(halfword target, scaled *italic break; } - halfword glyph = tex_aux_new_math_glyph(fnt, chr, subtype); + glyph = tex_aux_new_math_glyph(fnt, chr, subtype); tex_attach_attribute_list_copy(glyph, nucleus); if (node_type(nucleus) == math_char_node) { glyph_properties(glyph) = kernel_math_properties(nucleus); @@ -6050,7 +6119,7 @@ static halfword tex_aux_unroll_noad(halfword tail, halfword l, quarterword s) while (l) { halfword n = node_next(l); node_next(l) = null; - if (node_type(l) == hlist_node && (s < 0 || node_subtype(l) == s) && ! box_source_anchor(l)) { + if (node_type(l) == hlist_node && (node_subtype(l) == s) && ! box_source_anchor(l)) { if (box_list(l)) { tex_couple_nodes(tail, box_list(l)); tail = tex_tail_of_node_list(tail); diff --git a/source/luametatex/source/tex/texnodes.c b/source/luametatex/source/tex/texnodes.c index c627a07cb..0134eb419 100644 --- a/source/luametatex/source/tex/texnodes.c +++ b/source/luametatex/source/tex/texnodes.c @@ -2451,7 +2451,7 @@ const char *tex_aux_subtype_str(halfword n) */ -void tex_print_specnode(halfword v, int unit) +static void tex_print_specnode(halfword v, int unit) /* for now local */ { if (tracing_nodes_par > 2) { tex_print_format("<%i>", v); @@ -2766,7 +2766,7 @@ void tex_show_node_list(halfword p, int threshold, int max) if (tex_par_state_is_set(p, par_pre_tolerance_code) ) { v = par_pre_tolerance(p) ; if (v) { tex_print_str(", pretolerance "); tex_print_int (v); } } if (tex_par_state_is_set(p, par_tolerance_code) ) { v = par_tolerance(p) ; if (v) { tex_print_str(", tolerance "); tex_print_int (v); } } if (tex_par_state_is_set(p, par_looseness_code) ) { v = par_looseness(p) ; if (v) { tex_print_str(", looseness "); tex_print_int (v); } } - if (tex_par_state_is_set(p, par_adjust_spacing_code) ) { v = par_adjust_spacing(p) ; if (v) { tex_print_str(", adjustaspacing "); tex_print_int (v); } } + if (tex_par_state_is_set(p, par_adjust_spacing_code) ) { v = par_adjust_spacing(p) ; if (v) { tex_print_str(", adjustspacing "); tex_print_int (v); } } if (tex_par_state_is_set(p, par_adj_demerits_code) ) { v = par_adj_demerits(p) ; if (v) { tex_print_str(", adjdemerits "); tex_print_int (v); } } if (tex_par_state_is_set(p, par_protrude_chars_code) ) { v = par_protrude_chars(p) ; if (v) { tex_print_str(", protrudechars "); tex_print_int (v); } } if (tex_par_state_is_set(p, par_line_penalty_code) ) { v = par_line_penalty(p) ; if (v) { tex_print_str(", linepenalty "); tex_print_int (v); } } @@ -3356,7 +3356,7 @@ scaled tex_glyph_depth(halfword p) /* not used */ scaledwhd tex_glyph_dimensions(halfword p) { - scaledwhd whd = { 0, 0, 0 }; + scaledwhd whd = { 0, 0, 0, 0 }; scaled x = glyph_x_offset(p); scaled y = glyph_y_offset(p); whd.ht = tex_char_height_from_glyph(p) + glyph_raise(p); @@ -3380,7 +3380,7 @@ scaledwhd tex_glyph_dimensions(halfword p) scaledwhd tex_glyph_dimensions_ex(halfword p) { - scaledwhd whd = { 0, 0, 0 }; + scaledwhd whd = { 0, 0, 0, 0 }; scaled x = glyph_x_offset(p); scaled y = glyph_y_offset(p); whd.ht = tex_char_height_from_glyph(p) + glyph_raise(p); @@ -3451,7 +3451,7 @@ halfword tex_kern_dimension_ex(halfword p) scaledwhd tex_pack_dimensions(halfword p) { - scaledwhd whd = { 0, 0, 0 }; + scaledwhd whd = { 0, 0, 0, 0 }; whd.ht = box_height(p); whd.dp = box_depth(p); whd.wd = box_width(p); @@ -4331,13 +4331,13 @@ void tex_check_disc_field(halfword n) void tex_set_discpart(halfword d, halfword h, halfword t, halfword code) { + halfword c = h; switch (node_subtype(d)) { case automatic_discretionary_code: case mathematics_discretionary_code: code = glyph_discpart_always; break; } - halfword c = h; while (c) { if (node_type(c) == glyph_node) { set_glyph_discpart(c, code); diff --git a/source/luametatex/source/tex/texnodes.h b/source/luametatex/source/tex/texnodes.h index a20117ff8..9e24ada27 100644 --- a/source/luametatex/source/tex/texnodes.h +++ b/source/luametatex/source/tex/texnodes.h @@ -1555,36 +1555,36 @@ typedef enum simple_choice_subtypes { \starttabulate[|l|l|l|l|l|l|] \FL - \BC \BC noad \BC accent \BC fraction \BC radical \NC fence \NC \NR - \ML \NC - \NC vlink 2 \NC new_hlist \NC \NC \NC \NC \NC \NR - \ML \NC - \NC vinfo 2 \NC nucleus \NC \NC \NC \NC \NC \NR - \NC vlink 3 \NC supscr \NC \NC numerator \NC \NC \NC \NR - \NC vinfo 3 \NC subscr \NC \NC denominator \NC \NC \NC \NR - \NC vlink 4 \NC supprescr \NC \NC \NC \NC \NC \NR - \NC vinfo 4 \NC subprescr \NC \NC \NC \NC \NC \NR - \ML \NC - \NC vlink 5 \NC italic \NC \NC \NC \NC \NC \NR - \NC vinfo 5 \NC width \NC \NC \NC \NC \NC \NR - \NC vlink 6 \NC height \NC \NC \NC \NC \NC \NR - \NC vinfo 6 \NC depth \NC \NC \NC \NC \NC \NR - \ML \NC - \NC vlink 7 \NC options \NC \NC \NC \NC \NC \NR - \NC vinfo 7 \NC style \NC \NC \NC \NC \NC \NR - \NC vlink 8 \NC family \NC \NC \NC \NC \NC \NR - \NC vinfo 8 \NC class \NC \NC \NC \NC \NC \NR - \NC vlink 9 \NC source \NC \NC \NC \NC \NC \NR - \NC vinfo 9 \NC prime \NC \NC \NC \NC \NC \NR - \NC vlink 10 \NC leftslack \NC \NC \NC \NC \NC \NR - \NC vinfo 10 \NC rightslack \NC \NC \NC \NC \NC \NR - \ML \NC - \NC vlink 11 \NC extra_1 \NC top_character \NC rule_thickness \NC degree \NC list \NC \NR - \NC vinfo 11 \NC extra_2 \NC bot_character \NC left_delimiter \NC left_delimiter \NC source \NC \NR - \NC vlink 12 \NC extra_3 \NC overlay_character \NC right_delimiter \NC right_delimiter \NC top \NC \NR - \NC vinfo 12 \NC extra_4 \NC fraction \NC middle_delimiter \NC \NC bottom \NC \NR - \NC vlink 13 \NC extra_5 \NC topovershoot \NC \NC height \NC \NC \NR - \NC vinfo 13 \NC extra_6 \NC botovershoot \NC \NC depth \NC \NC \NR + \BC \BC noad \BC accent \BC fraction \BC radical \NC fence \NC \NR + \ML \NC + \NC vlink 2 \NC new_hlist \NC \NC \NC \NC \NC \NR + \ML \NC + \NC vinfo 2 \NC nucleus \NC \NC \NC \NC \NC \NR + \NC vlink 3 \NC supscr \NC \NC numerator \NC \NC \NC \NR + \NC vinfo 3 \NC subscr \NC \NC denominator \NC \NC \NC \NR + \NC vlink 4 \NC supprescr \NC \NC \NC \NC \NC \NR + \NC vinfo 4 \NC subprescr \NC \NC \NC \NC \NC \NR + \ML \NC + \NC vlink 5 \NC italic \NC \NC \NC \NC \NC \NR + \NC vinfo 5 \NC width \NC \NC \NC \NC \NC \NR + \NC vlink 6 \NC height \NC \NC \NC \NC \NC \NR + \NC vinfo 6 \NC depth \NC \NC \NC \NC \NC \NR + \ML \NC + \NC vlink 7 \NC options \NC \NC \NC \NC \NC \NR + \NC vinfo 7 \NC style \NC \NC \NC \NC \NC \NR + \NC vlink 8 \NC family \NC \NC \NC \NC \NC \NR + \NC vinfo 8 \NC class \NC \NC \NC \NC \NC \NR + \NC vlink 9 \NC source \NC \NC \NC \NC \NC \NR + \NC vinfo 9 \NC prime \NC \NC \NC \NC \NC \NR + \NC vlink 10 \NC leftslack \NC \NC \NC \NC \NC \NR + \NC vinfo 10 \NC rightslack \NC \NC \NC \NC \NC \NR + \ML \NC + \NC vlink 11 \NC extra_1 \NC top_character \NC rule_thickness \NC degree \NC list \NC \NR + \NC vinfo 11 \NC extra_2 \NC bot_character \NC left_delimiter \NC left_delimiter \NC source \NC \NR + \NC vlink 12 \NC extra_3 \NC overlay_character \NC right_delimiter \NC right_delimiter \NC top \NC \NR + \NC vinfo 12 \NC extra_4 \NC fraction \NC middle_delimiter \NC \NC bottom \NC \NR + \NC vlink 13 \NC extra_5 \NC topovershoot \NC \NC height \NC topovershoot \NC \NR + \NC vinfo 13 \NC extra_6 \NC botovershoot \NC \NC depth \NC botovershoot \NC \NR \LL \stoptabulate @@ -1767,10 +1767,10 @@ inline int has_noad_no_script_option(halfword n, halfword option) return 0; } -# define has_noad_option_nosubscript(a) has_noad_no_script_option(a, noad_option_no_sub_script) -# define has_noad_option_nosupscript(a) has_noad_no_script_option(a, noad_option_no_super_script) -# define has_noad_option_nosubprescript(a) has_noad_no_script_option(a, noad_option_no_sub_pre_script) -# define has_noad_option_nosupprescript(a) has_noad_no_script_option(a, noad_option_no_super_pre_script) +# define has_noad_option_nosubscript(a) has_noad_no_script_option(a, noad_option_no_sub_script) +# define has_noad_option_nosupscript(a) has_noad_no_script_option(a, noad_option_no_super_script) +# define has_noad_option_nosubprescript(a) has_noad_no_script_option(a, noad_option_no_sub_pre_script) +# define has_noad_option_nosupprescript(a) has_noad_no_script_option(a, noad_option_no_super_pre_script) # define has_noad_option_shiftedsubscript(a) (has_option(noad_options(a), noad_option_shifted_sub_script)) # define has_noad_option_shiftedsupscript(a) (has_option(noad_options(a), noad_option_shifted_super_script)) @@ -1906,8 +1906,8 @@ typedef enum math_accent_subtypes { # define fence_delimiter_list noad_extra_1 // not really a list # define fence_delimiter_top noad_extra_3 # define fence_delimiter_bottom noad_extra_4 -//define fence_delimiter_first noad_extra_5 -//define fence_delimiter_last noad_extra_6 +# define fence_top_overshoot noad_extra_5 +# define fence_bottom_overshoot noad_extra_6 typedef enum fence_subtypes { unset_fence_side, @@ -2004,14 +2004,14 @@ typedef enum math_kernel_options { math_kernel_has_italic_shape = 0x0080, } math_kernel_options; -# define math_kernel_node_size 5 -# define kernel_math_family(a) vinfo(a,2) -# define kernel_math_character(a) vlink(a,2) -# define kernel_math_options(a) vinfo(a,3) -# define kernel_math_list(a) vlink(a,3) -# define kernel_math_properties(a) vinfo0(a,4) /* for characters */ -# define kernel_math_group(a) vinfo1(a,4) /* for characters */ -# define kernel_math_index(a) vlink(a,4) /* for characters */ +# define math_kernel_node_size 5 +# define kernel_math_family(a) vinfo(a,2) +# define kernel_math_character(a) vlink(a,2) +# define kernel_math_options(a) vinfo(a,3) +# define kernel_math_list(a) vlink(a,3) +# define kernel_math_properties(a) vinfo0(a,4) /* for characters */ +# define kernel_math_group(a) vinfo1(a,4) /* for characters */ +# define kernel_math_index(a) vlink(a,4) /* for characters */ # define math_kernel_node_has_option(a,b) ((kernel_math_options(a) & b) == b) # define math_kernel_node_set_option(a,b) kernel_math_options(a) = (kernel_math_options(a) | b) @@ -2021,6 +2021,26 @@ typedef enum math_kernel_options { in traditional \TEX\ fonts where a base character can come from one font, and the extensible from another, but in \OPENTYPE\ math font that doesn't happen. */ + +/* It could be: */ + +// # define math_delimiter_node_size 4 +// # define delimiter_small_family(a) vinfo00(a,2) +// # define delimiter_large_family(a) vinfo01(a,2) +// # define delimiter_reserved_1 vinfo02(a,2) +// # define delimiter_reserved_2 vinfo03(a,2) +// # define delimiter_reserved_3 vlink(a,2) +// # define delimiter_small_character(a) vinfo(a,3) +// # define delimiter_large_character(a) vlink(a,3) + +/* And some day (we then even assume traditionally to be mapped onto wide): */ + +// # define math_delimiter_node_size 3 +// # define delimiter_family(a) vinfo00(a,2) +// # define delimiter_reserved_1 vinfo01(a,2) +// # define delimiter_reserved_2 vinfo02(a,2) +// # define delimiter_reserved_3 vinfo03(a,2) +// # define delimiter_character(a) vlink(a,2) # define math_delimiter_node_size 4 # define delimiter_small_family(a) vinfo(a,2) /*tex |family| for small delimiter */ @@ -2538,15 +2558,20 @@ inline static void tex_attach_attribute_list_attribute(halfword target, halfword is used in the \LUA\ interface is stored alongside. */ -extern void tex_print_short_node_contents (halfword n); -extern void tex_show_node_list (halfword n, int threshold, int max); -extern halfword tex_actual_box_width (halfword r, scaled base_width); -extern void tex_print_name (halfword p, const char *what); -extern void tex_print_node_list (halfword n, const char *what, int threshold, int max); -/* void tex_print_node_and_details (halfword p); */ -/* void tex_print_subtype_and_attributes_info (halfword p, halfword s, node_info *data); */ -extern void tex_print_extended_subtype (halfword p, quarterword s); -extern void tex_aux_show_dictionary (halfword p, halfword properties, halfword group, halfword index, halfword font, halfword character); +extern void tex_print_short_node_contents (halfword n); +extern const char *tex_aux_subtype_str (halfword n); +extern void tex_show_node_list (halfword n, int threshold, int max); +extern halfword tex_actual_box_width (halfword r, scaled base_width); +extern void tex_print_name (halfword p, const char *what); +extern void tex_print_node_list (halfword n, const char *what, int threshold, int max); +/* void tex_print_node_and_details (halfword p); */ +/* void tex_print_subtype_and_attributes_info (halfword p, halfword s, node_info *data); */ +extern void tex_print_extended_subtype (halfword p, quarterword s); +extern void tex_aux_show_dictionary (halfword p, halfword properties, halfword group, halfword index, halfword font, halfword character); + +/*tex + Basic node management: +*/ extern halfword tex_new_node (quarterword i, quarterword j); extern void tex_flush_node_list (halfword n); @@ -2596,23 +2621,8 @@ typedef enum glue_signs { # define normal_glue_multiplier 0.0 -inline halfword tex_checked_glue_sign(halfword sign) -{ - if ((sign < min_glue_sign) || (sign > max_glue_sign)) { - return normal_glue_sign; - } else { - return sign; - } -} - -inline halfword tex_checked_glue_order(halfword order) -{ - if ((order < min_glue_order) || (order > max_glue_order)) { - return normal_glue_order; - } else { - return order; - } -} +inline halfword tex_checked_glue_sign (halfword sign) { return ((sign < min_glue_sign ) || (sign > max_glue_sign )) ? normal_glue_sign : sign ; } +inline halfword tex_checked_glue_order (halfword order) { return ((order < min_glue_order) || (order > max_glue_order)) ? normal_glue_order : order; } /*tex These are reserved nodes that sit at the start of main memory. We could actually just allocate @@ -2626,7 +2636,6 @@ inline halfword tex_checked_glue_order(halfword order) Changing this to real nodes makes sense but is also tricky due to initializations ... some day (we need to store stuff in teh states then and these are not saved!). - */ # define fi_glue (zero_glue + glue_spec_size) /*tex These are constants */ @@ -2683,6 +2692,8 @@ extern scaledwhd tex_glyph_dimensions_ex (halfword p); /* x/y scaled, expansion extern halfword tex_kern_dimension (halfword p); extern halfword tex_kern_dimension_ex (halfword p); /* expansion included */ +extern scaled tex_effective_glue (halfword parent, halfword glue); + extern scaledwhd tex_pack_dimensions (halfword p); extern halfword tex_list_node_mem_usage (void); @@ -2723,13 +2734,9 @@ typedef enum special_node_list_types { /* not in sycn with the above .. maybe ad // best_page_break_type } special_node_list_types; -extern int tex_is_special_node_list (halfword n, int *istail); -extern halfword tex_get_special_node_list (special_node_list_types list, halfword *tail); -extern void tex_set_special_node_list (special_node_list_types list, halfword head); - -extern scaled tex_effective_glue (halfword parent, halfword glue); - -extern const char *tex_aux_subtype_str (halfword n ); +extern int tex_is_special_node_list (halfword n, int *istail); +extern halfword tex_get_special_node_list (special_node_list_types list, halfword *tail); +extern void tex_set_special_node_list (special_node_list_types list, halfword head); # endif diff --git a/source/luametatex/source/tex/texpackaging.c b/source/luametatex/source/tex/texpackaging.c index b2286cd71..796c3c1b7 100644 --- a/source/luametatex/source/tex/texpackaging.c +++ b/source/luametatex/source/tex/texpackaging.c @@ -422,11 +422,11 @@ scaled tex_char_stretch(halfword p) /* todo: move this to texfont.c and make it halfword m = font_max_stretch(f); if (m > 0) { halfword c = glyph_character(p); - halfword ef = tex_char_ef_from_font(f, c); - if (ef > 0) { + scaled e = tex_char_ef_from_font(f, c); + if (e > 0) { scaled dw = tex_calculated_glyph_width(p, m) - tex_char_width_from_glyph(p); if (dw > 0) { - return tex_round_xn_over_d(dw, ef, 1000); + return tex_round_xn_over_d(dw, e, 1000); } } } @@ -441,11 +441,11 @@ scaled tex_char_shrink(halfword p) /* todo: move this to texfont.c and make it m halfword m = font_max_shrink(f); if (m > 0) { halfword c = glyph_character(p); - halfword ef = tex_char_ef_from_font(f, c); - if (ef > 0) { + scaled e = tex_char_cf_from_font(f, c); + if (e > 0) { scaled dw = tex_char_width_from_glyph(p) - tex_calculated_glyph_width(p, -m); if (dw > 0) { - return tex_round_xn_over_d(dw, ef, 1000); + return tex_round_xn_over_d(dw, e, 1000); } } } @@ -482,7 +482,7 @@ scaled tex_kern_shrink(halfword p) if (l && node_type(l) == glyph_node && ! tex_has_glyph_option(l, glyph_option_no_expansion)) { halfword m = font_max_shrink(glyph_font(l)); if (m > 0) { - halfword e = tex_char_ef_from_font(glyph_font(l), glyph_character(l)); + scaled e = tex_char_cf_from_font(glyph_font(l), glyph_character(l)); if (e > 0) { scaled dw = tex_round_xn_over_d(w, 1000 - m, 1000) - w; if (dw > 0) { @@ -503,20 +503,23 @@ static void tex_aux_set_kern_expansion(halfword p, halfword ex_ratio) if (l && node_type(l) == glyph_node && ! tex_has_glyph_option(l, glyph_option_no_expansion)) { halfword f = glyph_font(l); halfword c = glyph_character(l); - halfword ef = tex_char_ef_from_font(f, c); - if (ef == 0) { - return; - } else if (ex_ratio > 0) { - halfword m = font_max_stretch(f); - if (m > 0) { - halfword ex_stretch = tex_ext_xn_over_d(ex_ratio * ef, m, 1000000); - kern_expansion(p) = tex_fix_expand_value(f, ex_stretch) * 1000; + if (ex_ratio > 0) { + scaled e = tex_char_ef_from_font(f, c); + if (e > 0) { + halfword m = font_max_stretch(f); + if (m > 0) { + e = tex_ext_xn_over_d(ex_ratio * e, m, 1000000); + kern_expansion(p) = tex_fix_expand_value(f, e) * 1000; + } } } else if (ex_ratio < 0) { - halfword m = font_max_shrink(f); - if (m > 0) { - halfword ex_shrink = tex_ext_xn_over_d(ex_ratio * ef, m, 1000000); - kern_expansion(p) = tex_fix_expand_value(f, ex_shrink) * 1000; + scaled e = tex_char_cf_from_font(f, c); + if (e > 0) { + halfword m = font_max_shrink(f); + if (m > 0) { + e = tex_ext_xn_over_d(ex_ratio * e, m, 1000000); + kern_expansion(p) = tex_fix_expand_value(f, e) * 1000; + } } } } @@ -528,22 +531,27 @@ static void tex_aux_set_glyph_expansion(halfword p, int ex_ratio) switch (node_type(p)) { case glyph_node: if (! tex_has_glyph_option(p, glyph_option_no_expansion)) { - halfword f = glyph_font(p); - halfword c = glyph_character(p); - halfword ef = tex_char_ef_from_font(f, c); - if (ef == 0) { - return; - } else if (ex_ratio > 0) { - halfword m = font_max_stretch(f); - if (m > 0) { - halfword ex_stretch = tex_ext_xn_over_d(ex_ratio * ef, m, 1000000); - glyph_expansion(p) = tex_fix_expand_value(f, ex_stretch) * 1000; + if (ex_ratio > 0) { + halfword f = glyph_font(p); + halfword c = glyph_character(p); + scaled e = tex_char_ef_from_font(f, c); + if (e > 0) { + halfword m = font_max_stretch(f); + if (m > 0) { + e = tex_ext_xn_over_d(ex_ratio * e, m, 1000000); + glyph_expansion(p) = tex_fix_expand_value(f, e) * 1000; + } } } else if (ex_ratio < 0) { - halfword m = font_max_shrink(f); - if (m > 0) { - halfword ex_shrink = tex_ext_xn_over_d(ex_ratio * ef, m, 1000000); - glyph_expansion(p) = tex_fix_expand_value(f, ex_shrink) * 1000; + halfword f = glyph_font(p); + halfword c = glyph_character(p); + scaled e = tex_char_cf_from_font(f, c); + if (e > 0) { + halfword m = font_max_shrink(f); + if (m > 0) { + e = tex_ext_xn_over_d(ex_ratio * e, m, 1000000); + glyph_expansion(p) = tex_fix_expand_value(f, e) * 1000; + } } } } @@ -1039,7 +1047,7 @@ halfword tex_hpack(halfword p, scaled w, int m, singleword pack_direction, int r /*tex natural width */ scaled x = 0; /*tex the current direction */ - singleword hpack_dir = pack_direction == direction_unknown ? text_direction_par : pack_direction; + singleword hpack_dir = pack_direction == direction_unknown ?(singleword) text_direction_par : pack_direction; int disc_level = 0; halfword pack_interrupt[8]; scaled font_stretch = 0; @@ -1126,11 +1134,11 @@ halfword tex_hpack(halfword p, scaled w, int m, singleword pack_direction, int r break; } case packing_substitute: - { - lmt_packaging_state.previous_char_ptr = p; + lmt_packaging_state.previous_char_ptr = p; + if (lmt_packaging_state.font_expansion_ratio != 0) { tex_aux_set_glyph_expansion(p, lmt_packaging_state.font_expansion_ratio); - break; } + break; } } whd = tex_glyph_dimensions_ex(p); @@ -1256,10 +1264,10 @@ halfword tex_hpack(halfword p, scaled w, int m, singleword pack_direction, int r break; } case packing_substitute: - { + if (lmt_packaging_state.font_expansion_ratio != 0) { tex_aux_set_kern_expansion(p, lmt_packaging_state.font_expansion_ratio); - break; } + break; } } x += tex_kern_dimension_ex(p); @@ -1274,7 +1282,9 @@ halfword tex_hpack(halfword p, scaled w, int m, singleword pack_direction, int r */ break; case packing_substitute: - tex_aux_set_glyph_expansion(p, lmt_packaging_state.font_expansion_ratio); + if (lmt_packaging_state.font_expansion_ratio != 0) { + tex_aux_set_glyph_expansion(p, lmt_packaging_state.font_expansion_ratio); + } break; } } @@ -1575,7 +1585,7 @@ halfword tex_hpack(halfword p, scaled w, int m, singleword pack_direction, int r halfword tex_filtered_hpack(halfword p, halfword qt, scaled w, int m, int grp, halfword d, int just_pack, halfword attr, int state, int retain) { halfword head; - singleword direction = checked_direction_value(d); + singleword direction = (singleword) checked_direction_value(d); (void) state; /*tex Why do we pass it? Probably a left-over from an experiment. */ if (just_pack) { head = node_next(p); @@ -1603,7 +1613,7 @@ halfword tex_filtered_hpack(halfword p, halfword qt, scaled w, int m, int grp, h scaledwhd tex_natural_hsizes(halfword p, halfword pp, glueratio g_mult, int g_sign, int g_order) { - scaledwhd siz = { 0, 0, 0 }; + scaledwhd siz = { 0, 0, 0, 0 }; scaled gp = 0; scaled gm = 0; while (p && p != pp) { @@ -1757,7 +1767,7 @@ scaledwhd tex_natural_hsizes(halfword p, halfword pp, glueratio g_mult, int g_si scaledwhd tex_natural_vsizes(halfword p, halfword pp, glueratio g_mult, int g_sign, int g_order) { - scaledwhd siz = { 0, 0, 0 }; + scaledwhd siz = { 0, 0, 0, 0 }; scaled gp = 0; scaled gm = 0; while (p && p != pp) { @@ -1974,7 +1984,7 @@ halfword tex_natural_hsize(halfword p, halfword *correction) halfword tex_natural_vsize(halfword p) { - scaledwhd siz = { 0, 0, 0 }; + scaledwhd siz = { 0, 0, 0, 0 }; while (p) { switch (node_type(p)) { case hlist_node: @@ -2293,7 +2303,7 @@ halfword tex_filtered_vpack(halfword p, scaled h, int m, scaled maxdepth, int gr if (! just_pack) { q = lmt_vpack_filter_callback(q, h, m, maxdepth, grp, direction, attr); } - q = tex_vpack(q, h, m, maxdepth, checked_direction_value(direction), retain); + q = tex_vpack(q, h, m, maxdepth, (singleword) checked_direction_value(direction), retain); if (q && normalize_par_mode_permitted(normalize_par_mode_par, flatten_v_leaders_mode) && ! is_box_package_state(state, package_u_leader_delayed)) { tex_flatten_leaders(q, NULL); } @@ -3111,7 +3121,7 @@ halfword tex_vert_break(halfword p, scaled h, scaled d) prev_p = p; p = node_next(prev_p); } - return best_place; + return best_place; /* unreachable */ } /*tex diff --git a/source/luametatex/source/tex/texprimitive.c b/source/luametatex/source/tex/texprimitive.c index 42344af15..d5f2b0927 100644 --- a/source/luametatex/source/tex/texprimitive.c +++ b/source/luametatex/source/tex/texprimitive.c @@ -182,7 +182,7 @@ static int tex_aux_room_in_hash(void) */ -inline static halfword tex_aux_compute_hash(const char *j, int l) +inline static halfword tex_aux_compute_hash(const char *j, unsigned l) { halfword h = (unsigned const char) j[0]; for (unsigned k = 1; k < l; k++) { @@ -504,7 +504,7 @@ static halfword tex_aux_insert_id(halfword p, const unsigned char *j, unsigned i halfword tex_id_locate(int j, int l, int create) { /*tex The index in |hash| array: */ - halfword h = tex_aux_compute_hash((char *) (lmt_fileio_state.io_buffer + j), l); + halfword h = tex_aux_compute_hash((char *) (lmt_fileio_state.io_buffer + j), (unsigned) l); /*tex We start searching here. Note that |0 <= h < hash_prime|: */ halfword p = h + hash_base; /*tex The next one in a list: */ @@ -536,7 +536,7 @@ halfword tex_id_locate(int j, int l, int create) halfword tex_string_locate(const char *s, size_t l, int create) { /*tex The hash code: */ - halfword h = tex_aux_compute_hash(s, (int) l); + halfword h = tex_aux_compute_hash(s, (unsigned) l); /*tex The index in |hash| array. We start searching here. Note that |0 <= h < hash_prime|: */ halfword p = h + hash_base; while (1) { @@ -702,7 +702,7 @@ void tex_print_cmd_flags(halfword cs, halfword cmd, int flags, int escaped) if (is_instance (flags)) { (escaped ? tex_print_str_esc : tex_print_str)("instance " ); } if (is_untraced (flags)) { (escaped ? tex_print_str_esc : tex_print_str)("untraced " ); } } - if (is_tolerant_cmd (cmd)) { + if (is_tolerant_cmd(cmd)) { (escaped ? tex_print_str_esc : tex_print_str)("tolerant " ); } if (is_protected_cmd(cmd)) { diff --git a/source/luametatex/source/tex/texprinting.c b/source/luametatex/source/tex/texprinting.c index deabb4b72..860ff6731 100644 --- a/source/luametatex/source/tex/texprinting.c +++ b/source/luametatex/source/tex/texprinting.c @@ -590,10 +590,6 @@ void tex_print_hex(int sn) unsigned int n = (unsigned int) sn; int k = 0; unsigned char digits[24]; - if (n < 0) { - tex_print_char('-'); - n = -n; - } do { unsigned char d = (unsigned char) (n % 16); if (d < 10) { @@ -695,30 +691,38 @@ void tex_print_current_string(void) void tex_print_cs_checked(halfword p) { - if (p == null_cs) { - tex_print_str_esc("csname"); - tex_print_str_esc("endcsname"); - tex_print_char(' '); - } else if (p < hash_base) { - tex_print_str(error_string_impossible(11)); - } else if (p == undefined_control_sequence) { - tex_print_str_esc("undefined"); - tex_print_char(' '); - } else if (eqtb_out_of_range(p)) { - tex_print_str(error_string_impossible(12)); - } else { - strnumber t = cs_text(p); - if (t < 0 || t >= lmt_string_pool_state.string_pool_data.ptr) { - tex_print_str(error_string_nonexistent(13)); - } else if (tex_is_active_cs(t)) { - tex_print_tex_str(active_cs_value(t)); - } else { - tex_print_tex_str_esc(t); - if (! tex_single_letter(t) || (tex_get_cat_code(cat_code_table_par, aux_str2uni(str_string(t))) == letter_cmd)) { - tex_print_char(' '); + switch (tex_cs_state(p)) { + case cs_no_error: + { + strnumber t = cs_text(p); + if (t < 0 || t >= lmt_string_pool_state.string_pool_data.ptr) { + tex_print_str(error_string_nonexistent(13)); + } else if (tex_is_active_cs(t)) { + tex_print_tex_str(active_cs_value(t)); + } else { + tex_print_tex_str_esc(t); + if (! tex_single_letter(t) || (tex_get_cat_code(cat_code_table_par, aux_str2uni(str_string(t))) == letter_cmd)) { + tex_print_char(' '); + } + } } - } - } + break; + case cs_null_error: + tex_print_str_esc("csname"); + tex_print_str_esc("endcsname"); + tex_print_char(' '); + break; + case cs_below_base_error: + tex_print_str(error_string_impossible(11)); + break; + case cs_undefined_error: + tex_print_str_esc("undefined"); + tex_print_char(' '); + break; + case cs_out_of_range_error: + tex_print_str(error_string_impossible(12)); + break; + } } /*tex diff --git a/source/luametatex/source/tex/texscanning.c b/source/luametatex/source/tex/texscanning.c index fec04356b..5480910dc 100644 --- a/source/luametatex/source/tex/texscanning.c +++ b/source/luametatex/source/tex/texscanning.c @@ -668,7 +668,7 @@ static int tex_aux_set_cur_val_by_some_cmd(int code) case math_char_class_code: case math_char_fam_code: case math_char_slot_code: - /* we actually need two commands or we need to look ahead */ + /* we actually need two commands or we need to look ahead */ { mathcodeval mval = { 0, 0, 0 }; mathdictval dval = { 0, 0, 0 }; @@ -1594,6 +1594,14 @@ static halfword tex_aux_scan_something_internal(halfword cmd, halfword chr, int cur_val_level = int_val_level; break; } + case font_cf_code: + { + halfword fnt = tex_scan_font_identifier(NULL); + halfword chr = tex_scan_char_number(0); + cur_val = tex_char_cf_from_font(fnt, chr); + cur_val_level = int_val_level; + break; + } case font_dimen_code: { cur_val = tex_get_font_dimen(); @@ -1975,8 +1983,8 @@ halfword tex_scan_int(int optional_equal, int *radix) *radix = 8; } while (1) { - tex_get_x_token(); unsigned d = 0; + tex_get_x_token(); if ((cur_tok >= zero_token) && (cur_tok <= seven_token)) { d = cur_tok - zero_token; } else { @@ -1997,7 +2005,7 @@ halfword tex_scan_int(int optional_equal, int *radix) } } } - break; + // break; } case hex_token: { @@ -2005,8 +2013,8 @@ halfword tex_scan_int(int optional_equal, int *radix) *radix = 16; } while (1) { - tex_get_x_token(); unsigned d = 0; + tex_get_x_token(); if ((cur_tok >= zero_token) && (cur_tok <= nine_token)) { d = cur_tok - zero_token; } else if ((cur_tok >= A_token_l) && (cur_tok <= F_token_l)) { @@ -2031,7 +2039,7 @@ halfword tex_scan_int(int optional_equal, int *radix) } } } - break; + // break; } default: { @@ -2061,7 +2069,7 @@ halfword tex_scan_int(int optional_equal, int *radix) } tex_get_x_token(); } - break; + // break; } } DONE: @@ -2099,8 +2107,8 @@ int tex_scan_cardinal(unsigned *value, int dontbark) case octal_token: { while (1) { - tex_get_x_token(); unsigned d = 0; + tex_get_x_token(); if ((cur_tok >= zero_token) && (cur_tok <= seven_token)) { d = cur_tok - zero_token; } else { @@ -2112,13 +2120,13 @@ int tex_scan_cardinal(unsigned *value, int dontbark) result = max_cardinal; } } - break; + // break; } case hex_token: { while (1) { - tex_get_x_token(); unsigned d = 0; + tex_get_x_token(); if ((cur_tok >= zero_token) && (cur_tok <= nine_token)) { d = cur_tok - zero_token; } else if ((cur_tok >= A_token_l) && (cur_tok <= F_token_l)) { @@ -2134,7 +2142,7 @@ int tex_scan_cardinal(unsigned *value, int dontbark) result = max_cardinal; } } - break; + // break; } default: { @@ -2152,7 +2160,7 @@ int tex_scan_cardinal(unsigned *value, int dontbark) } tex_get_x_token(); } - break; + // break; } } DONE: @@ -2304,6 +2312,7 @@ typedef enum scanned_unit { static int tex_aux_scan_unit(halfword *num, halfword *denom, halfword *value, halfword *order) { + AGAIN: /* only for true */ do { tex_get_x_token(); } while (cur_cmd == spacer_cmd); @@ -2327,7 +2336,6 @@ static int tex_aux_scan_unit(halfword *num, halfword *denom, halfword *value, ha goto BACK_TWO; } cur_cs = save_cur_cs; - AGAIN: switch (chrone) { case 'p': case 'P': switch (chrtwo) { @@ -2405,7 +2413,7 @@ static int tex_aux_scan_unit(halfword *num, halfword *denom, halfword *value, ha switch (chrtwo) { case 'r': case 'R': if (tex_scan_mandate_keyword("true", 2)) { - /*tex This is now a bogus prefix! */ + /*tex This is now a bogus prefix that might get dropped! */ goto AGAIN; } } @@ -4178,7 +4186,7 @@ static void tex_aux_scan_expr(halfword level) node_subtype(t) = 0; /* */ node_next(t) = top; - expression_type(t) = (quarterword) level; + expression_type(t) = (singleword) level; expression_state(t) = (singleword) state; expression_result(t) = (singleword) result; expression_expression(t) = expression; @@ -4576,7 +4584,7 @@ static const char *bit_expression_names[] = { variant that only uses doubles: |dimenexpression| and |numberexpression|. */ -# define factor 1000 +# define factor 1 // 256, 1000 : wrong results so needs a fix typedef struct stack_info { halfword head; @@ -4879,8 +4887,8 @@ static halfword tex_scan_bit_int(int *radix) *radix = 8; } while (1) { - tex_get_x_token(); unsigned d = 0; + tex_get_x_token(); if ((cur_tok >= zero_token) && (cur_tok <= seven_token)) { d = cur_tok - zero_token; } else { @@ -4896,7 +4904,7 @@ static halfword tex_scan_bit_int(int *radix) } } } - break; + // break; } case hex_token: { @@ -4904,8 +4912,8 @@ static halfword tex_scan_bit_int(int *radix) *radix = 16; } while (1) { - tex_get_x_token(); unsigned d = 0; + tex_get_x_token(); if ((cur_tok >= zero_token) && (cur_tok <= nine_token)) { d = cur_tok - zero_token; } else if ((cur_tok >= A_token_l) && (cur_tok <= F_token_l)) { @@ -4925,7 +4933,7 @@ static halfword tex_scan_bit_int(int *radix) } } } - break; + // break; } default: { @@ -4950,7 +4958,7 @@ static halfword tex_scan_bit_int(int *radix) } tex_get_x_token(); } - break; + // break; } } DONE: @@ -5066,6 +5074,8 @@ static void tex_aux_trace_expression(stack_info stack, halfword level, halfword tex_end_diagnostic(); } +/* This one is not yet okay ... work in progress. */ + static void tex_aux_scan_expression(int level) { stack_info operators = tex_aux_new_stack(); @@ -5521,7 +5531,7 @@ static void tex_aux_scan_expression(int level) break; case bit_expression_multiply: { - double d = va * vb; + double d = (double) va * (double) vb; if (sa == bit_expression_float) { d = d / (65536 * factor); } else if (sb == bit_expression_float) { @@ -5687,7 +5697,7 @@ int tex_scan_tex_value(halfword level, halfword *value) quarterword tex_scan_direction(int optional_equal) { int i = tex_scan_int(optional_equal, NULL); - return checked_direction_value(i); + return (quarterword) checked_direction_value(i); } halfword tex_scan_geometry(int optional_equal) diff --git a/source/luametatex/source/tex/textoken.c b/source/luametatex/source/tex/textoken.c index 93bf3913a..7dd9c888b 100644 --- a/source/luametatex/source/tex/textoken.c +++ b/source/luametatex/source/tex/textoken.c @@ -161,13 +161,12 @@ void tex_compact_tokens(void) { int nc = 0; // memoryword *target = allocate_array(sizeof(memoryword), (size_t) token_memory_state.tokens_data.allocated, 0); - memoryword *target = aux_allocate_clear_array(sizeof(memoryword), (size_t) lmt_token_memory_state.tokens_data.allocated, 0); - halfword *mapper = aux_allocate_array(sizeof(halfword), (size_t) lmt_token_memory_state.tokens_data.allocated, 0); + memoryword *target = aux_allocate_clear_array(sizeof(memoryword), lmt_token_memory_state.tokens_data.allocated, 0); + halfword *mapper = aux_allocate_array(sizeof(halfword), lmt_token_memory_state.tokens_data.allocated, 0); int nofluacmds = 0; if (target && mapper) { - // memset((void *) target, 0, ((size_t) token_memory_state.tokens_data.allocated) * sizeof(memoryword)); - memset((void *) mapper, -1, ((size_t) lmt_token_memory_state.tokens_data.allocated) * sizeof(halfword)); memoryword *tokens = lmt_token_memory_state.tokens; + memset((void *) mapper, -1, ((size_t) lmt_token_memory_state.tokens_data.allocated) * sizeof(halfword)); /* also reset available */ for (int cs = 0; cs < (eqtb_size + lmt_hash_state.hash_data.ptr + 1); cs++) { switch (eq_type(cs)) { @@ -579,8 +578,6 @@ static const char *tex_aux_special_cmd_string(halfword cmd, halfword chr, const } } -halfword nn = 0; - halfword tex_show_token_list(halfword p, halfword q, int l, int asis) { if (p) { @@ -794,7 +791,6 @@ halfword tex_scan_character(const char *s, int left_brace, int skip_space, int s } else { goto DONE; } - break; case relax_cmd: if (skip_relax) { break; @@ -3082,6 +3078,13 @@ char *tex_tokenlist_to_tstring(int pp, int inhibit_par, int *siz, int skippreamb /*tex We need to go beyond the reference. */ int p = token_link(pp); if (p) { + int e = escape_char_par; /*tex The serialization of the escape, normally a backlash. */ + int n = '0'; /*tex The character after |#|, so |#0| upto |#9| */ + int min = 0; + int max = lmt_token_memory_state.tokens_data.top; + int skip = 0; + int tail = p; + int count = 0; if (lmt_token_state.bufmax > default_buffer_size) { /* Let's start fresh and small. */ aux_deallocate_array(lmt_token_state.buffer); @@ -3093,13 +3096,6 @@ char *tex_tokenlist_to_tstring(int pp, int inhibit_par, int *siz, int skippreamb lmt_token_state.bufmax = default_buffer_size; } lmt_token_state.bufloc = 0; - int e = escape_char_par; /*tex The serialization of the escape, normally a backlash. */ - int n = '0'; /*tex The character after |#|, so |#0| upto |#9| */ - int min = 0; - int max = lmt_token_memory_state.tokens_data.top; - int skip = 0; - int tail = p; - int count = 0; if (skippreamble) { skip = get_token_parameters(pp); } diff --git a/source/luametatex/source/utilities/auxarithmetic.h b/source/luametatex/source/utilities/auxarithmetic.h index 8daf6f29a..ac01c10ca 100644 --- a/source/luametatex/source/utilities/auxarithmetic.h +++ b/source/luametatex/source/utilities/auxarithmetic.h @@ -53,7 +53,7 @@ in some places we clip to the official maxima but not always. //define zround(r) ((r>2147483647.0) ? 2147483647 : ((r<-2147483647.0) ? -2147483647 : ((r >= 0.0) ? (int)(r + 0.5) : ((int)(r-0.5))))) //define zround(r) ((r>2147483647.0) ? 2147483647 : ((r<-2147483647.0) ? -2147483647 : (int) lround(r))) -# define scaledround(x) ((scaled) lround((double) x)) +# define scaledround(x) ((scaled) lround((double) (x))) # define longlonground llround # define clippedround(r) ((r>2147483647.0) ? 2147483647 : ((r<-2147483647.0) ? -2147483647 : (int) lround(r))) # define glueround(x) clippedround((double) (x)) diff --git a/source/luametatex/source/utilities/auxsparsearray.c b/source/luametatex/source/utilities/auxsparsearray.c index c3f2c7687..3ea8f1c46 100644 --- a/source/luametatex/source/utilities/auxsparsearray.c +++ b/source/luametatex/source/utilities/auxsparsearray.c @@ -128,21 +128,23 @@ int sa_get_item_2(const sa_tree head, int n) return (int) head->dflt.ushort_value[n%2]; } -sa_tree_item sa_get_item_4(const sa_tree head, int n) +int sa_get_item_4(const sa_tree head, int n, sa_tree_item *v) { if (head->tree) { int h = LMT_SA_H_PART(n); if (head->tree[h]) { int m = LMT_SA_M_PART(n); if (head->tree[h][m]) { - return head->tree[h][m][LMT_SA_L_PART(n)]; + *v = head->tree[h][m][LMT_SA_L_PART(n)]; + return 1; } } } - return head->dflt; + *v = head->dflt; + return 0; } -sa_tree_item sa_get_item_8(const sa_tree head, int n, sa_tree_item *v2) +int sa_get_item_8(const sa_tree head, int n, sa_tree_item *v1, sa_tree_item *v2) { if (head->tree != NULL) { int h = LMT_SA_H_PART(n); @@ -150,13 +152,15 @@ sa_tree_item sa_get_item_8(const sa_tree head, int n, sa_tree_item *v2) int m = LMT_SA_M_PART(n); if (head->tree[h][m]) { int l = 2*LMT_SA_L_PART(n); + *v1 = head->tree[h][m][l]; *v2 = head->tree[h][m][l+1]; - return head->tree[h][m][l]; + return 1; } } } + *v1 = head->dflt; *v2 = head->dflt; - return head->dflt; + return 0; } void sa_set_item_1(sa_tree head, int n, int v, int gl) diff --git a/source/luametatex/source/utilities/auxsparsearray.h b/source/luametatex/source/utilities/auxsparsearray.h index a1a902c54..91e310074 100644 --- a/source/luametatex/source/utilities/auxsparsearray.h +++ b/source/luametatex/source/utilities/auxsparsearray.h @@ -105,24 +105,24 @@ typedef struct sa_tree_head { typedef sa_tree_head *sa_tree; -extern int sa_get_item_1 (const sa_tree head, int n); -extern int sa_get_item_2 (const sa_tree head, int n); -extern sa_tree_item sa_get_item_4 (const sa_tree head, int n); -extern sa_tree_item sa_get_item_8 (const sa_tree head, int n, sa_tree_item * v2); -extern void sa_set_item_1 (sa_tree head, int n, int v, int gl); -extern void sa_set_item_2 (sa_tree head, int n, int v, int gl); -extern void sa_set_item_4 (sa_tree head, int n, sa_tree_item v, int gl); -extern void sa_set_item_8 (sa_tree head, int n, sa_tree_item v1, sa_tree_item v2, int gl); -extern sa_tree sa_new_tree (int size, int bytes, sa_tree_item dflt); -extern sa_tree sa_copy_tree (sa_tree head); -extern void sa_destroy_tree (sa_tree head); -extern void sa_dump_tree (dumpstream f, sa_tree a); -extern sa_tree sa_undump_tree (dumpstream f); -extern void sa_restore_stack (sa_tree a, int gl); -extern void sa_clear_stack (sa_tree a); - -extern void sa_set_item_n (const sa_tree head, int n, int v, int gl); -extern int sa_get_item_n (const sa_tree head, int n); +extern int sa_get_item_1 (const sa_tree head, int n); /* these return the value or dflt */ +extern int sa_get_item_2 (const sa_tree head, int n); /* these return the value or dflt */ +extern int sa_get_item_4 (const sa_tree head, int n, sa_tree_item *v); /* these return success */ +extern int sa_get_item_8 (const sa_tree head, int n, sa_tree_item *v1, sa_tree_item *v2); /* these return success */ +extern void sa_set_item_1 (sa_tree head, int n, int v, int gl); +extern void sa_set_item_2 (sa_tree head, int n, int v, int gl); +extern void sa_set_item_4 (sa_tree head, int n, sa_tree_item v, int gl); +extern void sa_set_item_8 (sa_tree head, int n, sa_tree_item v1, sa_tree_item v2, int gl); +extern sa_tree sa_new_tree (int size, int bytes, sa_tree_item dflt); +extern sa_tree sa_copy_tree (sa_tree head); +extern void sa_destroy_tree (sa_tree head); +extern void sa_dump_tree (dumpstream f, sa_tree a); +extern sa_tree sa_undump_tree (dumpstream f); +extern void sa_restore_stack (sa_tree a, int gl); +extern void sa_clear_stack (sa_tree a); + +extern void sa_set_item_n (const sa_tree head, int n, int v, int gl); +extern int sa_get_item_n (const sa_tree head, int n); inline static halfword sa_return_item_1(sa_tree head, halfword n) { diff --git a/source/luametatex/source/utilities/auxunistring.c b/source/luametatex/source/utilities/auxunistring.c index 30dc518e6..10ae6393d 100644 --- a/source/luametatex/source/utilities/auxunistring.c +++ b/source/luametatex/source/utilities/auxunistring.c @@ -58,8 +58,9 @@ unsigned char *aux_uni2str(unsigned unic) buf[2] = (unsigned char) (0x80 | (unic & 0x3f)); buf[3] = '\0'; } else if (unic < 0x110000) { + int u; unic -= 0x10000; - int u = (int) (((unic & 0xf0000) >> 16) + 1); + u = (int) (((unic & 0xf0000) >> 16) + 1); buf[0] = (unsigned char) (0xf0 | (u >> 2)); buf[1] = (unsigned char) (0x80 | ((u & 3) << 4) | ((unic & 0x0f000) >> 12)); buf[2] = (unsigned char) (0x80 | ((unic & 0x00fc0) >> 6)); @@ -92,8 +93,9 @@ char *aux_uni2string(char *utf8_text, unsigned unic) *utf8_text++ = (char) (0x80 | ((unic >> 6) & 0x3f)); *utf8_text++ = (char) (0x80 | (unic & 0x3f)); } else if (unic < 0x110000) { + unsigned u; unic -= 0x10000; - unsigned u = ((unic & 0xf0000) >> 16) + 1; + u = ((unic & 0xf0000) >> 16) + 1; *utf8_text++ = (char) (0xf0 | (u >> 2)); *utf8_text++ = (char) (0x80 | ((u & 3) << 4) | ((unic & 0x0f000) >> 12)); *utf8_text++ = (char) (0x80 | ((unic & 0x00fc0) >> 6)); diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 32680be28..0b5c9bdf9 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2022.10.22 11:20} +\newcontextversion{2022.11.14 22:54} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 73cbdb23f..e4fb9c469 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2022.10.22 11:20} +\edef\contextversion{2022.11.14 22:54} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii index 0d2c7c424..c78135316 100644 --- a/tex/context/base/mkii/mult-fr.mkii +++ b/tex/context/base/mkii/mult-fr.mkii @@ -93,7 +93,6 @@ \setinterfacevariable{author}{auteur} \setinterfacevariable{auto}{auto} \setinterfacevariable{autointro}{autointro} -\setinterfacevariable{autopunctuation}{autoponctuation} \setinterfacevariable{back}{retour} \setinterfacevariable{background}{arriereplan} \setinterfacevariable{backmatter}{pagesdefin} @@ -677,9 +676,13 @@ \setinterfaceconstant{authoretaltext}{auteuretaltexte} \setinterfaceconstant{auto}{auto} \setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofencing}{autofencing} \setinterfaceconstant{autofile}{autofichier} \setinterfaceconstant{autofocus}{autofocus} \setinterfaceconstant{autohang}{autosuspendre} +\setinterfaceconstant{autonumbers}{autonumbers} +\setinterfaceconstant{autopunctuation}{autoponctuation} +\setinterfaceconstant{autospacing}{autospacing} \setinterfaceconstant{autostrut}{autoentretoise} \setinterfaceconstant{autowidth}{autolargeur} \setinterfaceconstant{availableheight}{hauteurdisponible} diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua index 6fe56a062..8f1bc4fb0 100644 --- a/tex/context/base/mkiv/char-ini.lua +++ b/tex/context/base/mkiv/char-ini.lua @@ -817,6 +817,19 @@ local is_symbol = allocate ( tohash { "sm", "sc", "sk", "so", } ) +local can_have_space = allocate ( tohash { + "lu", "ll", "lt", "lm", "lo", -- letters + -- "mn", "mc", "me", -- marks + "nd", "nl", "no", -- numbers + "ps", "pi", -- initial + -- "pe", "pf", -- final + -- "pc", "pd", "po", -- punctuation + "sm", "sc", "sk", "so", -- symbols + -- "zs", "zl", "zp", -- separators + -- "cc", "cf", "cs", "co", "cn", -- others +} ) + + -- to be redone: store checked characters characters.is_character = is_character @@ -827,6 +840,7 @@ characters.is_mark = is_mark characters.is_punctuation = is_punctuation characters.is_hyphenator = is_hyphenator characters.is_symbol = is_symbol +characters.can_have_space = can_have_space local mti = function(t,k) if type(k) == "number" then @@ -837,13 +851,14 @@ local mti = function(t,k) end end -setmetatableindex(characters.is_character, mti) -setmetatableindex(characters.is_letter, mti) -setmetatableindex(characters.is_command, mti) -setmetatableindex(characters.is_spacing, mti) -setmetatableindex(characters.is_punctuation,mti) -setmetatableindex(characters.is_hyphenator, mti) -setmetatableindex(characters.is_symbol, mti) +setmetatableindex(characters.is_character, mti) +setmetatableindex(characters.is_letter, mti) +setmetatableindex(characters.is_command, mti) +setmetatableindex(characters.is_spacing, mti) +setmetatableindex(characters.is_punctuation, mti) +setmetatableindex(characters.is_hyphenator, mti) +setmetatableindex(characters.is_symbol, mti) +setmetatableindex(characters.can_have_space, mti) -- todo: also define callers for the above diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 4c07bceb5..333a3dc54 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.10.22 11:20} +\newcontextversion{2022.11.14 22:54} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 86374e2d7..db4a0a66f 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2022.10.22 11:20} +\edef\contextversion{2022.11.14 22:54} %D Kind of special: diff --git a/tex/context/base/mkiv/font-cft.lua b/tex/context/base/mkiv/font-cft.lua index 267c63f7a..d6afc01f7 100644 --- a/tex/context/base/mkiv/font-cft.lua +++ b/tex/context/base/mkiv/font-cft.lua @@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['font-cft'] = { license = "see context related readme files" } --- context font tables (needs updating) +-- context font tables (needs updating, only okay for mkiv) -- -- todo: extra: -- diff --git a/tex/context/base/mkiv/font-con.lua b/tex/context/base/mkiv/font-con.lua index 5c156c2ba..820e45f52 100644 --- a/tex/context/base/mkiv/font-con.lua +++ b/tex/context/base/mkiv/font-con.lua @@ -388,20 +388,20 @@ function constructors.scale(tfmdata,specification) -- local mathsize = tonumber(specification.mathsize) or 0 local textsize = tonumber(specification.textsize) or scaledpoints - local forcedsize = tonumber(parameters.mathsize ) or 0 -- can be set by the feature "mathsize" + -- local forcedsize = tonumber(parameters.mathsize ) or 0 -- can be set by the feature "mathsize" local extrafactor = tonumber(specification.factor ) or 1 - if (mathsize == 2 or forcedsize == 2) and parameters.scriptpercentage then - scaledpoints = parameters.scriptpercentage * textsize / 100 - elseif (mathsize == 3 or forcedsize == 3) and parameters.scriptscriptpercentage then - scaledpoints = parameters.scriptscriptpercentage * textsize / 100 - elseif forcedsize > 1000 then -- safeguard - scaledpoints = forcedsize - else - -- in context x and xx also use mathsize - end + -- if (mathsize == 2 or forcedsize == 2) and parameters.scriptpercentage then + -- scaledpoints = parameters.scriptpercentage * textsize / 100 + -- elseif (mathsize == 3 or forcedsize == 3) and parameters.scriptscriptpercentage then + -- scaledpoints = parameters.scriptscriptpercentage * textsize / 100 + -- elseif forcedsize > 1000 then -- safeguard + -- scaledpoints = forcedsize + -- else + -- -- in context x and xx also use mathsize + -- end targetparameters.mathsize = mathsize -- context specific targetparameters.textsize = textsize -- context specific - targetparameters.forcedsize = forcedsize -- context specific + -- targetparameters.forcedsize = forcedsize -- context specific targetparameters.extrafactor = extrafactor -- context specific -- local addtounicode = constructors.addtounicode diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua index 1735b4cdc..f5e12c0ef 100644 --- a/tex/context/base/mkiv/font-dsp.lua +++ b/tex/context/base/mkiv/font-dsp.lua @@ -2332,12 +2332,11 @@ do local reported = { } - local function report_issue(i,what,sequence,kind) - local name = sequence.name - if not reported[name] then - report("rule %i in %s lookup %a has %s lookups",i,what,name,kind) - reported[name] = true - end + local function report_issue(i,what,step,kind) +-- if not reported[step] then + report("rule %i in step %i of %s has %s lookups",i,step,what,kind) +-- reported[name] = true +-- end end -- for i=lastsequence+1,nofsequences do @@ -2346,18 +2345,18 @@ do -- for i=1,#steps do -- local step = steps[i] - for i=1,#allsteps do -- new per 2022-09-25 - local step = allsteps[i] -- new per 2022-09-25 + for s=1,#allsteps do -- new per 2022-09-25 + local step = allsteps[s] -- new per 2022-09-25 local rules = step.rules if rules then for i=1,#rules do local rule = rules[i] local rlookups = rule.lookups if not rlookups then - report_issue(i,what,sequence,"no") + report_issue(i,what,s,"no") elseif not next(rlookups) then -- can be ok as it aborts a chain sequence - -- report_issue(i,what,sequence,"empty") + -- report_issue(i,what,s,"empty") rule.lookups = nil else -- we can have holes in rlookups flagged false and we can have multiple lookups @@ -2398,12 +2397,12 @@ do sublookupcheck[lookupid] = 1 h = nofsublookups else - report_issue(i,what,sequence,"missing") + report_issue(i,what,s,"missing") rule.lookups = nil break end else - report_issue(i,what,sequence,"bad") + report_issue(i,what,s,"bad") rule.lookups = nil break end @@ -2977,7 +2976,7 @@ local function readmathvariants(f,fontdata,offset) -- advance = readushort(f), -- } - local function get(offset,coverage,nofglyphs,construction,kvariants,kparts,kitalic) + local function get(offset,coverage,nofglyphs,construction,kvariants,kparts,kitalic,korientation,orientation) if coverage ~= 0 and nofglyphs > 0 then local coverage = readcoverage(f,offset+coverage,true) for i=1,nofglyphs do @@ -3042,14 +3041,23 @@ local function readmathvariants(f,fontdata,offset) if italic and italic ~= 0 then math[kitalic] = italic end + if orientation then + math[korientation] = orientation + end end end end end end - get(offset,vcoverage,vnofglyphs,vconstruction,"vvariants","vparts","vitalic") - get(offset,hcoverage,hnofglyphs,hconstruction,"hvariants","hparts","hitalic") + -- if LUATEXENGINE == "luametatex" then + if CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 then + get(offset,hcoverage,hnofglyphs,hconstruction,"variants","parts","partsitalic","partsorientation","horizontal") + get(offset,vcoverage,vnofglyphs,vconstruction,"variants","parts","partsitalic","partsorientation","vertical") + else + get(offset,vcoverage,vnofglyphs,vconstruction,"vvariants","vparts","vitalic") + get(offset,hcoverage,hnofglyphs,hconstruction,"hvariants","hparts","hitalic") + end end function readers.math(f,fontdata,specification) diff --git a/tex/context/base/mkiv/font-ini.mkvi b/tex/context/base/mkiv/font-ini.mkvi index ccd034106..c51019fdd 100644 --- a/tex/context/base/mkiv/font-ini.mkvi +++ b/tex/context/base/mkiv/font-ini.mkvi @@ -474,15 +474,52 @@ \installcorenamespace{mappedfontsize} +% \unexpanded\def\mapfontsize +% {\dodoubleargument\font_basics_map_fontsize} + +% \def\font_basics_map_fontsize[#from][#to]% +% {\setvalue{\??mappedfontsize\the\dimexpr#from\relax}{#to}} + +% \def\font_basics_set_mapped_fontsize#from% +% {\ifcsname\??mappedfontsize\the\dimexpr#from\relax\endcsname +% \lastnamedcs\else#from% +% \fi} + +%letcsname\??mappedfontsize\s!text \endcsname\!!plusone +\letcsname\??mappedfontsize\s!script \endcsname\!!plustwo +\letcsname\??mappedfontsize\s!scriptscript\endcsname\!!plusthree + \unexpanded\def\mapfontsize - {\dodoubleargument\font_basics_map_fontsize} + {\dotripleargument\font_basics_map_fontsize} + +\def\font_basics_map_fontsize[#class][#from][#to]% + {\setvalue{% + \??mappedfontsize + #class:% + \ifcsname\??mappedfontsize#from\endcsname\lastnamedcs\else1\fi + }{#to}} + +\permanent\tolerant\protected\def\checkedmapfontsize[#class]#spacer[#from]#spacer[#to]% + {\ifcsname\??mappedfontsize#class:\csname\??mappedfontsize#from\endcsname\endcsname + % keep (user) value + \else + \mapfontsize[#class][#from][#to]% + \fi} -\def\font_basics_map_fontsize[#from][#to]% - {\setvalue{\??mappedfontsize\the\dimexpr#from\relax}{#to}} +\permanent\tolerant\def\mappedfontsize#class#from% + {\begincsname + \??mappedfontsize + #class:% + \ifcsname\??mappedfontsize#from\endcsname\lastnamedcs\else1\fi + \endcsname} \def\font_basics_set_mapped_fontsize#from% - {\ifcsname\??mappedfontsize\the\dimexpr#from\relax\endcsname - \lastnamedcs\else#from% + {\ifcsname\??mappedfontsize\fontclass:\fontface\endcsname + %\the\dimexpr\lastnamedcs\dimexpr#from\relax\relax + %\the\dimexpr\lastnamedcs\dimexpr\bodyfontsize\relax\relax + \the\dimexpr\lastnamedcs\dimexpr\normalizedbodyfontsize\relax\relax + \else % we could use default + #from% \fi} \installcorenamespace{fontbodyknown} diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua index 5ae6659c5..4937dca31 100644 --- a/tex/context/base/mkiv/font-mis.lua +++ b/tex/context/base/mkiv/font-mis.lua @@ -21,7 +21,7 @@ local readers = otf.readers if readers then - otf.version = otf.version or 3.121 + otf.version = otf.version or 3.130 otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true) function fonts.helpers.getfeatures(name,save) diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index 9493bd03c..4199db03f 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.121 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.130 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.pngcache = containers.define("fonts", "png", otf.version, true) @@ -643,25 +643,25 @@ local function read_from_otf(specification) return tfmdata end -local function checkmathsize(tfmdata,mathsize) - local mathdata = tfmdata.shared.rawdata.metadata.math - local mathsize = tonumber(mathsize) - if mathdata then -- we cannot use mathparameters as luatex will complain - local parameters = tfmdata.parameters - parameters.scriptpercentage = mathdata.ScriptPercentScaleDown - parameters.scriptscriptpercentage = mathdata.ScriptScriptPercentScaleDown - parameters.mathsize = mathsize -- only when a number ! - end -end - -registerotffeature { - name = "mathsize", - description = "apply mathsize specified in the font", - initializers = { - base = checkmathsize, - node = checkmathsize, - } -} +-- local function checkmathsize(tfmdata,mathsize) +-- local mathdata = tfmdata.shared.rawdata.metadata.math +-- local mathsize = tonumber(mathsize) +-- if mathdata then -- we cannot use mathparameters as luatex will complain +-- local parameters = tfmdata.parameters +-- parameters.scriptpercentage = mathdata.ScriptPercentScaleDown +-- parameters.scriptscriptpercentage = mathdata.ScriptScriptPercentScaleDown +-- parameters.mathsize = mathsize -- only when a number ! +-- end +-- end +-- +-- registerotffeature { +-- name = "mathsize", +-- description = "apply mathsize specified in the font", +-- initializers = { +-- base = checkmathsize, +-- node = checkmathsize, +-- } +-- } -- readers diff --git a/tex/context/base/mkiv/font-oto.lua b/tex/context/base/mkiv/font-oto.lua index 1475fcf67..e8b92c077 100644 --- a/tex/context/base/mkiv/font-oto.lua +++ b/tex/context/base/mkiv/font-oto.lua @@ -504,6 +504,9 @@ local function featuresinitializer(tfmdata,value) local value = features[feature] if value then local validlookups, lookuplist = collectlookups(rawdata,feature,script,language) +-- if not validlookups and not lookuplist and script == "math" then +-- validlookups, lookuplist = collectlookups(rawdata,feature,"dflt","dflt") +-- end if not validlookups then -- skip elseif basesubstitutions and basesubstitutions[feature] then diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua index 248aad04d..198e62bee 100644 --- a/tex/context/base/mkiv/font-oup.lua +++ b/tex/context/base/mkiv/font-oup.lua @@ -898,26 +898,42 @@ local function unifyglyphs(fontdata,usenames) end end -- - for index=1,nofglyphs do - local math = glyphs[index].math - if math then - local list = math.vparts - if list then - for i=1,#list do local l = list[i] l.glyph = indices[l.glyph] end - end - local list = math.hparts - if list then - for i=1,#list do local l = list[i] l.glyph = indices[l.glyph] end - end - local list = math.vvariants - if list then - -- for i=1,#list do local l = list[i] l.glyph = indices[l.glyph] end - for i=1,#list do list[i] = indices[list[i]] end + if LUATEXENGINE == "luametatex" then + for index=1,nofglyphs do + local math = glyphs[index].math + if math then + local list = math.parts + if list then + for i=1,#list do local l = list[i] l.glyph = indices[l.glyph] end + end + local list = math.variants + if list then + for i=1,#list do list[i] = indices[list[i]] end + end end - local list = math.hvariants - if list then - -- for i=1,#list do local l = list[i] l.glyph = indices[l.glyph] end - for i=1,#list do list[i] = indices[list[i]] end + end + else + for index=1,nofglyphs do + local math = glyphs[index].math + if math then + local list = math.vparts + if list then + for i=1,#list do local l = list[i] l.glyph = indices[l.glyph] end + end + local list = math.hparts + if list then + for i=1,#list do local l = list[i] l.glyph = indices[l.glyph] end + end + local list = math.vvariants + if list then + -- for i=1,#list do local l = list[i] l.glyph = indices[l.glyph] end + for i=1,#list do list[i] = indices[list[i]] end + end + local list = math.hvariants + if list then + -- for i=1,#list do local l = list[i] l.glyph = indices[l.glyph] end + for i=1,#list do list[i] = indices[list[i]] end + end end end end @@ -947,7 +963,6 @@ end local stripredundant do - local p_hex = R("af","AF","09") local p_digit = R("09") local p_done = S("._-")^0 + P(-1) diff --git a/tex/context/base/mkiv/font-sel.lua b/tex/context/base/mkiv/font-sel.lua index 04dd4379b..ab6297f40 100644 --- a/tex/context/base/mkiv/font-sel.lua +++ b/tex/context/base/mkiv/font-sel.lua @@ -77,19 +77,24 @@ local report_typescript = logs.reporter("selectfont","typescripts") defaults["rm"] = { features = { ["sc"] = "*,f:smallcaps" } } defaults["ss"] = { features = { ["sc"] = "*,f:smallcaps" } } -defaults["asanamath"] = { options = { extras = "asana-math", features = "math\\mathsizesuffix", goodies = "anana-math" } } -defaults["cambriamath"] = { options = { extras = "cambria-math", features = "math\\mathsizesuffix", goodies = "cambria-math" } } -defaults["dejavumath"] = { options = { extras = "dejavu", features = "math\\mathsizesuffix" } } -defaults["neoeuler"] = { options = { extras = "euler-math", features = "math\\mathsizesuffix" } } -defaults["latinmodernmath"] = { options = { extras = "lm,lm-math", features = "math\\mathsizesuffix,lm-math", goodies = "lm" } } -defaults["lucidabrightmathot"] = { options = { extras = "lucida-opentype-math", features = "math\\mathsizesuffix", goodies = "lucida-opentype-math" } } -defaults["minionmath"] = { options = { extras = "minion-math", features = "math\\mathsizesuffix", goodies = "minion-math" } } -defaults["texgyredejavumath"] = { options = { extras = "dejavu", features = "math\\mathsizesuffix" } } -defaults["texgyrepagellamath"] = { options = { extras = "texgyre", features = "math\\mathsizesuffix" } } -defaults["texgyrebonummath"] = { options = { extras = "texgyre", features = "math\\mathsizesuffix" } } -defaults["texgyrescholamath"] = { options = { extras = "texgyre", features = "math\\mathsizesuffix" } } -defaults["texgyretermesmath"] = { options = { extras = "texgyre", features = "math\\mathsizesuffix" } } -defaults["xitsmath"] = { options = { extras = "xits-math", features = "math\\mathsizesuffix", goodies = "xits-math" } } +-- WS: we need to check the extras with the typescripts + +defaults["asanamath"] = { options = { extras = "asana-math", features = "math\\mathsizesuffix,mathextra", goodies = "anana-math" } } +defaults["cambriamath"] = { options = { extras = "cambria-math", features = "math\\mathsizesuffix,mathextra", goodies = "cambria-math" } } +defaults["euler"] = { options = { extras = "euler-math", features = "math\\mathsizesuffix,mathextra", goodies = "euler-math" } } +defaults["latinmodernmath"] = { options = { extras = "lm,lm-math", features = "math\\mathsizesuffix,mathextra,lm-math", goodies = "modern" } } +defaults["lucidabrightmathot"] = { options = { extras = "lucida-opentype-math", features = "math\\mathsizesuffix,mathextra", goodies = "lucida-math" } } +defaults["minionmath"] = { options = { extras = "minion-math", features = "math\\mathsizesuffix,mathextra", goodies = "minion-math" } } +defaults["stixtwomath"] = { options = { extras = "stix-two-math", features = "math\\mathsizesuffix,mathextra", goodies = "stixtwo-math" } } +defaults["texgyredejavumath"] = { options = { extras = "dejavu", features = "math\\mathsizesuffix,mathextra", goodies = "dejavu-math" } } +defaults["texgyrepagellamath"] = { options = { extras = "texgyre", features = "math\\mathsizesuffix,mathextra", goodies = "pagella-math" } } +defaults["texgyrebonummath"] = { options = { extras = "texgyre", features = "math\\mathsizesuffix,mathextra", goodies = "bonum-math" } } +defaults["texgyrescholamath"] = { options = { extras = "texgyre", features = "math\\mathsizesuffix,mathextra", goodies = "schola-math" } } +defaults["texgyretermesmath"] = { options = { extras = "texgyre", features = "math\\mathsizesuffix,mathextra", goodies = "termes-math" } } +defaults["xitsmath"] = { options = { extras = "xits-math", features = "math\\mathsizesuffix,mathextra", goodies = "xits-math" } } + +defaults["neoeuler"] = defaults["euler"] +defaults["dejavumath"] = defaults["texgyredejavumath"] extras["features"] = function(data,alternative,features) local d = data.options.features diff --git a/tex/context/base/mkiv/font-shp.lua b/tex/context/base/mkiv/font-shp.lua index cab4b7540..feae0ba1c 100644 --- a/tex/context/base/mkiv/font-shp.lua +++ b/tex/context/base/mkiv/font-shp.lua @@ -17,7 +17,7 @@ local pfb = fonts.handlers.pfb local hashes = fonts.hashes local identifiers = hashes.identifiers -local version = otf.version or 0.013 +local version = otf.version or 0.014 local shapescache = containers.define("fonts", "shapes", version, true) local streamscache = containers.define("fonts", "streams", version, true) diff --git a/tex/context/base/mkiv/font-ttf.lua b/tex/context/base/mkiv/font-ttf.lua index d1a3972b2..0f3838c88 100644 --- a/tex/context/base/mkiv/font-ttf.lua +++ b/tex/context/base/mkiv/font-ttf.lua @@ -263,20 +263,28 @@ local function applyaxis(glyph,shape,deltas,dowidth) end if found == last then lastindex = currentindex - break; + break elseif found > last then + +-- \definefontfeature[book][default][axis={weight=800}] +-- \definefont[testfont][file:Commissioner-vf-test.ttf*book] +-- \testfont EΘÄΞ +while lastindex > 1 and dpoints[lastindex] > last do + lastindex = lastindex - 1 +end + break end end end - -- print("unicode: ",glyph.unicode or "?") - -- print("contour: ",first,contour,last) - -- print("index : ",firstindex,lastindex,cnt) - -- print("points : ",dpoints[firstindex],dpoints[lastindex]) + -- print("unicode: ",glyph.unicode or "?") + -- print("contour: ",first,contour,last) + -- print("index : ",firstindex,lastindex,cnt) + -- print("points : ",dpoints[firstindex],dpoints[lastindex]) local function find(i) local prv = lastindex for j=firstindex,lastindex do - local nxt = dpoints[j] + local nxt = dpoints[j] -- we could save this lookup when we return it if nxt == i then return false, j, false elseif nxt > i then @@ -980,8 +988,8 @@ local function readglyph(f,nofcontours) -- read deltas here, saves space local x = 0 for i=1,nofpoints do local flag = flags[i] - -- local short = band(flag,0x04) ~= 0 - -- local same = band(flag,0x20) ~= 0 + -- local short = band(flag,0x02) ~= 0 + -- local same = band(flag,0x10) ~= 0 if band(flag,0x02) ~= 0 then if band(flag,0x10) ~= 0 then x = x + readbyte(f) diff --git a/tex/context/base/mkiv/lang-def.mkiv b/tex/context/base/mkiv/lang-def.mkiv index 441d328c8..19f431ebf 100644 --- a/tex/context/base/mkiv/lang-def.mkiv +++ b/tex/context/base/mkiv/lang-def.mkiv @@ -269,6 +269,23 @@ \c!rightquotation=\leftguillemot, \c!date={\v!day,{.},\space,\v!month,\space,\v!year}] +\installlanguage + [\s!hy] + [\c!spacing=\v!packed, + \c!leftsentence=\endash, % *sentences not confirmed + \c!rightsentence=\endash, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, + \c!leftquote=\guilsingleleft, + \c!rightquote=\guilsingleright, + \c!leftquotation=\leftguillemot + \c!rightquotation=\rightguillemot + \c!date={\v!day,\space,\v!month,\space,\v!year}, % word + % \c!date={\v!day,{.},\v!month,{.},\v!year}, % numbers + \s!patterns=\s!hy, + \s!lefthyphenmin=2, + \s!righthyphenmin=2] + \installlanguage [\s!polish] [\s!pl] \installlanguage [\s!czech] [\s!cs] \installlanguage [\s!slovak] [\s!sk] @@ -276,6 +293,10 @@ \installlanguage [\s!slovenian] [\s!sl] \installlanguage [slovene] [\s!sl] % both possible (mojca: still needed?) +\installlanguage [\s!armenian] [\s!hy] +\installlanguage [\s!hye] [\s!hy] % Eastern Armenian +\installlanguage [\s!hyw] [\s!hy] % Western Armenian + % Cyrillic Languages \installlanguage diff --git a/tex/context/base/mkiv/lang-txt.lua b/tex/context/base/mkiv/lang-txt.lua index 834f9ce43..c4f3603ec 100644 --- a/tex/context/base/mkiv/lang-txt.lua +++ b/tex/context/base/mkiv/lang-txt.lua @@ -32,11 +32,13 @@ if not modules then modules = { } end modules ['lang-txt'] = { -- eo Esperanto Alain Delmotte (2021) -- es Spanish Andrés Montoya, ... -- et Estonian Clyde Johnston (2018) --- fi Finish ... +-- fa Persian Mohammad Hossein Bateni (2016) +-- fi Finnish ... -- fr French Daniel Flipo, Arthur Reutenauer -- gr Greek Apostolos Syropoulos, Thomas Schmitz -- hr Croatian Željko Vrba, Richard Gabriel, Vedran Miletić -- hu Hungarian Adam Reviczky +-- hy Armenian Kristina Nazarjanová (2022) -- it Italian Giuseppe Bilotta, Luigi Scarso -- ja Japanese Richard Gabriel -- kr Korean Jeong Dalyoung @@ -46,7 +48,6 @@ if not modules then modules = { } end modules ['lang-txt'] = { -- nb Norwegian Hans Fredrik Nordhaug, ... -- nn Norwegian Hans Fredrik Nordhaug, ... -- nl Dutch Hans Hagen --- pe Persian Mohammad Hossein Bateni (2016) -- pl Polish Grzegorz Sapijaszko (2011) -- pt Portuguese Pedro F. M. Mendonça -- ro Romanian Dan Seracu, ... @@ -88,6 +89,7 @@ data.labels={ ["es"]="En", ["fa"]="در", ["fr"]="Dans", + ["hy"]="Մեջ", ["mk"]="во", ["sr"]="У", ["sr-latn"]="U", @@ -102,6 +104,7 @@ data.labels={ ["eo"]="Nombro", ["fa"]="شماره", ["fr"]="Numéro", + ["hy"]="Համար", ["mk"]="Број", ["nl"]="Nummer", ["sr"]="Број", @@ -117,10 +120,11 @@ data.labels={ ["eo"]="Volumo", ["et"]="Köide", ["fa"]="جلد", + ["hy"]="Ծավալ", ["mk"]="Том", ["nl"]="Deel", - ["sr"]="Том", ["sr-latn"]="Tom", + ["sr"]="Том", }, }, ["and"]={ @@ -134,6 +138,7 @@ data.labels={ ["et"]="ja", ["fa"]="و", ["fr"]="et", + ["hy"]="և", ["it"]="e", ["mk"]="и", ["nl"]="en", @@ -152,6 +157,7 @@ data.labels={ ["et"]="väljaanne", ["fa"]="ویرایش", ["fr"]="édition", + ["hy"]="հրատարակություն", ["it"]="edizione", ["mk"]="издание", ["nl"]="editie", @@ -169,6 +175,7 @@ data.labels={ ["et"]="toimetaja", ["fa"]="ویراستار", ["fr"]="éditeur", + ["hy"]="խմբագիր", ["it"]="a cura di", ["mk"]="уредник", ["sr"]="уредник", @@ -185,6 +192,7 @@ data.labels={ ["es"]="editores", ["et"]="toimetajad", ["fr"]="éditeurs", + ["hy"]="խմբագիրներ", ["it"]="a cura di", ["mk"]="уредници", ["sr"]="уредници", @@ -201,6 +209,7 @@ data.labels={ ["es"]="en", ["fa"]="در", ["fr"]="dans", + ["hy"]="մեջ", ["mk"]="во", ["sr"]="у", ["sr-latn"]="u", @@ -217,6 +226,7 @@ data.labels={ ["et"]="magistritöö", ["fa"]="پایاننامه کارشناسی ارشد", ["fr"]="Thèse de master (DEA, DESS, master)", + ["hy"]="Մագիստրոսական թեզ", ["it"]="Tesi di laurea", ["mk"]="Магистерска дисертација", ["nl"]="Masterproef", @@ -233,6 +243,7 @@ data.labels={ ["eo"]="numero", ["fa"]="شماره", ["fr"]="numéro", + ["hy"]="համար", ["mk"]="број", ["nl"]="nummer", ["sr"]="број", @@ -247,6 +258,7 @@ data.labels={ ["en"]="of", ["eo"]="de", ["fr"]="de", + ["hy"]="-ից", ["mk"]="од", ["nl"]="van", ["sr"]="од", @@ -259,6 +271,7 @@ data.labels={ ["en"]="et al.", ["eo"]="aliaj", ["et"]="jt", + ["hy"]="եւ այլն", ["mk"]="и др.", ["sr"]="и др.", ["sr-latn"]="i dr.", @@ -272,6 +285,7 @@ data.labels={ ["eo"]="p.", ["et"]="lk", ["fa"]="ص", + ["hy"]="էջ", ["mk"]="стр.", ["sr"]="стр.", ["sr-latn"]="str.", @@ -286,6 +300,7 @@ data.labels={ ["eo"]="paĝoj", ["et"]="leheküljed", ["fa"]="صفحات", + ["hy"]="էջեր", ["mk"]="страници", ["nl"]="paginas", ["sr"]="страницa", @@ -302,6 +317,7 @@ data.labels={ ["es"]="Patente", ["et"]="Patent", ["fr"]="Brevet", + ["hy"]="Արտոնագիր", ["it"]="Brevetto", ["mk"]="Патент", ["nl"]="Octrooi", @@ -320,6 +336,7 @@ data.labels={ ["et"]="doktoritöö", ["fa"]="رساله دکتری", ["fr"]="Thèse de doctorat", + ["hy"]="Դոկտորական թեզ", ["it"]="Tesi di dottorato", ["mk"]="Докторска дисертација", ["nl"]="Proefschrift", @@ -334,6 +351,7 @@ data.labels={ ["eo"]="pp.", ["et"]="lk-d", ["fa"]="صص", + ["hy"]="էջ", ["mk"]="стр.", ["sr"]="стр.", ["sr-latn"]="str.", @@ -350,6 +368,7 @@ data.labels={ ["et"]="tehniline raport", ["fa"]="گزارش فنی", ["fr"]="Rapport technique", + ["hy"]="Տեխնիկական հաշվետվություն", ["it"]="Relazione tecnica", ["mk"]="Технички извештај", ["nl"]="Technisch rapport", @@ -366,6 +385,7 @@ data.labels={ ["eo"]="volumo", ["et"]="köide", ["fa"]="جلد", + ["hy"]="ծավալ", ["mk"]="том", ["nl"]="deel", ["sr"]="том", @@ -382,6 +402,7 @@ data.labels={ ["es"]="con", ["et"]="koos", ["fr"]="avec", + ["hy"]="ի հետ", ["it"]="con", ["mk"]="со", ["nl"]="met", @@ -396,6 +417,7 @@ data.labels={ ["cs"]="P", ["en"]="Pr", ["eo"]="P", + ["hy"]="P", ["mk"]="P", ["sk"]="P", ["sr"]="P", @@ -409,6 +431,7 @@ data.labels={ ["eo"]="arccos", ["es"]="arc\\sixperemspace cos", ["hr"]="arc\\sixperemspace cos", + ["hy"]="arccos", ["mk"]="arccos", ["pl"]="arc\\sixperemspace cos", ["sk"]="arccos", @@ -423,6 +446,7 @@ data.labels={ ["eo"]="arccosh", ["es"]="arc\\sixperemspace cosh", ["hr"]="arc\\sixperemspace cosh", + ["hy"]="arccosh", ["mk"]="arccosh", ["pl"]="arc\\sixperemspace cosh", ["sk"]="arccosh", @@ -437,6 +461,7 @@ data.labels={ ["eo"]="arcctan", ["es"]="arc\\sixperemspace cot", ["hr"]="arc\\sixperemspace ctg", + ["hy"]="arcctg", ["mk"]="arccotg", ["pl"]="arc\\sixperemspace ctg", ["sk"]="arccotg", @@ -451,6 +476,7 @@ data.labels={ ["eo"]="arcsin", ["es"]="arc\\sixperemspace sen", ["hr"]="arc\\sixperemspace sin", + ["hy"]="arcsin", ["mk"]="arcsin", ["pl"]="arc\\sixperemspace sin", ["sk"]="arcsin", @@ -465,6 +491,7 @@ data.labels={ ["eo"]="arcsinh", ["es"]="arc\\sixperemspace senh", ["hr"]="arc\\sixperemspace sinh", + ["hy"]="arcsinh", ["mk"]="arcsinh", ["pl"]="arc\\sixperemspace sinh", ["sk"]="arcsinh", @@ -479,6 +506,7 @@ data.labels={ ["eo"]="arctang", ["es"]="arc\\sixperemspace tan", ["hr"]="arc\\sixperemspace tg", + ["hy"]="arctan", ["mk"]="arctg", ["pl"]="arc\\sixperemspace tg", ["sk"]="arctg", @@ -493,6 +521,7 @@ data.labels={ ["eo"]="arctanh", ["es"]="arc\\sixperemspace tanh", ["hr"]="arc\\sixperemspace tgh", + ["hy"]="arctanh", ["mk"]="arctgh", ["pl"]="arc\\sixperemspace tgh", ["sk"]="arctgh", @@ -506,6 +535,7 @@ data.labels={ ["en"]="arg", ["eo"]="arg", ["es"]="arg", + ["hy"]="arg", ["mk"]="arg", ["sk"]="arg", ["sr"]="arg", @@ -518,6 +548,7 @@ data.labels={ ["en"]="cos", ["eo"]="cos", ["es"]="cos", + ["hy"]="cos", ["mk"]="cos", ["sk"]="cos", ["sr"]="cos", @@ -530,6 +561,7 @@ data.labels={ ["en"]="cosh", ["eo"]="cosh", ["es"]="cosh", + ["hy"]="cosh", ["mk"]="cosh", ["sk"]="cosh", ["sr"]="cosh", @@ -543,6 +575,7 @@ data.labels={ ["eo"]="cotan", ["es"]="cot", ["hr"]="ctg", + ["hy"]="cot", ["mk"]="ctg", ["pl"]="ctg", ["sk"]="cotg", @@ -556,6 +589,7 @@ data.labels={ ["en"]="coth", ["eo"]="cotanh", ["es"]="coth", + ["hy"]="coth", ["mk"]="ctgh", ["sk"]="cotgh", ["sr"]="ctgh", @@ -568,6 +602,7 @@ data.labels={ ["en"]="csc", ["eo"]="cosec", ["es"]="csc", + ["hy"]="csc", ["mk"]="cosec", ["sk"]="cosec", ["sr"]="cosec", @@ -581,6 +616,7 @@ data.labels={ ["eo"]="cotan", ["es"]="cot", ["hr"]="ctg", + ["hy"]="cot", ["mk"]="ctg", ["pl"]="ctg", ["sk"]="cotg", @@ -594,6 +630,7 @@ data.labels={ ["en"]="deg", ["eo"]="gr", ["es"]="gr", + ["hy"]="deg", ["mk"]="deg", ["sk"]="deg", ["sr"]="deg", @@ -606,6 +643,7 @@ data.labels={ ["en"]="det", ["eo"]="det", ["es"]="det", + ["hy"]="det", ["sk"]="det", ["sr"]="det", ["sr-latn"]="det", @@ -615,6 +653,7 @@ data.labels={ ["labels"]={ ["en"]="d", ["eo"]="dif", + ["hy"]="diff", }, }, ["dim"]={ @@ -623,6 +662,7 @@ data.labels={ ["en"]="dim", ["eo"]="dim", ["es"]="dim", + ["hy"]="dim", ["mk"]="dim", ["sk"]="dim", ["sr"]="dim", @@ -635,6 +675,7 @@ data.labels={ ["en"]="exp", ["eo"]="eksp", ["es"]="exp", + ["hy"]="exp", ["sk"]="exp", ["sr"]="exp", ["sr-latn"]="exp", @@ -648,6 +689,7 @@ data.labels={ ["eo"]="", ["es"]="mcd", ["hr"]="nzd", + ["hy"]="ԱԸԲ", ["mk"]="НЗД", ["nl"]="ggd", ["sk"]="NSD", @@ -661,6 +703,7 @@ data.labels={ ["en"]="hom", ["eo"]="hom", ["es"]="hom", + ["hy"]="հոմ", ["sk"]="Hom", }, }, @@ -670,6 +713,7 @@ data.labels={ ["en"]="inf", ["eo"]="inf", ["es"]="inf", + ["hy"]="inf", ["mk"]="inf", ["sk"]="inf", ["sr"]="inf", @@ -682,6 +726,7 @@ data.labels={ ["en"]="inv", ["eo"]="inv", ["es"]="inv", + ["hy"]="inv", ["mk"]="inv", ["sk"]="inv", ["sr"]="inv", @@ -694,6 +739,7 @@ data.labels={ ["en"]="inj\\sixperemspace lim", ["eo"]="", ["es"]="lím\\sixperemspace iny", + ["hy"]="inj\\sixperemspace lim", ["sk"]="inj\\sixperemspace lim", ["sr"]="inj\\sixperemspace lim", ["sr-latn"]="inj\\sixperemspace lim", @@ -705,6 +751,7 @@ data.labels={ ["en"]="ker", ["eo"]="", ["es"]="Ker", + ["hy"]="ker", ["sk"]="ker", ["sr"]="ker", ["sr-latn"]="ker", @@ -718,6 +765,7 @@ data.labels={ ["eo"]="", ["es"]="MCM", ["hr"]="nzv", + ["hy"]="աըբ", ["mk"]="НЗС", ["nl"]="kgv", ["sk"]="NSN", @@ -732,6 +780,7 @@ data.labels={ ["en"]="lg", ["eo"]="log", ["es"]="log", + ["hy"]="lg", ["mk"]="lg", ["sk"]="log", ["sr"]="lg", @@ -744,6 +793,7 @@ data.labels={ ["en"]="lim", ["eo"]="lim", ["es"]="lím", + ["hy"]="lim", ["mk"]="lim", ["sk"]="lim", ["sr"]="lim", @@ -756,6 +806,7 @@ data.labels={ ["en"]="lim\\sixperemspace inf", ["eo"]="subinf", ["es"]="lím\\sixperemspace inf", + ["hy"]="lim\\sixperemspace infs", ["mk"]="lim\\sixperemspace inf", ["sk"]="lim\\sixperemspace inf", ["sr"]="lim\\sixperemspace inf", @@ -768,6 +819,7 @@ data.labels={ ["en"]="lim\\sixperemspace sup", ["eo"]="suplim", ["es"]="lím\\sixperemspace sup", + ["hy"]="lim\\sixperemspace sup", ["mk"]="lim\\sixperemspace sup", ["sk"]="lim\\sixperemspace sup", ["sr"]="lim\\sixperemspace sup", @@ -780,6 +832,7 @@ data.labels={ ["en"]="ln", ["eo"]="ln", ["es"]="ln", + ["hy"]="ln", ["mk"]="ln", ["sk"]="ln", ["sr"]="ln", @@ -792,6 +845,7 @@ data.labels={ ["en"]="log", ["eo"]="log", ["es"]="log", + ["hy"]="log", ["mk"]="log", ["sk"]="log", ["sr"]="log", @@ -804,6 +858,7 @@ data.labels={ ["en"]="max", ["eo"]="maks", ["es"]="máx", + ["hy"]="max", ["mk"]="max", ["sk"]="max", ["sr"]="max", @@ -816,6 +871,7 @@ data.labels={ ["en"]="median", ["eo"]="mediano", ["es"]="Mediana", + ["hy"]="միջին", ["sk"]="\\tilde", ["sr"]="median", ["sr-latn"]="median", @@ -827,6 +883,7 @@ data.labels={ ["en"]="min", ["eo"]="min", ["es"]="mín", + ["hy"]="min", ["mk"]="min", ["sk"]="min", ["sr"]="min", @@ -839,6 +896,7 @@ data.labels={ ["en"]="mod", ["eo"]="mod", ["es"]="mod", + ["hy"]="mod", ["mk"]="mod", ["sk"]="mod", ["sr"]="mod", @@ -851,6 +909,7 @@ data.labels={ ["en"]="proj\\sixperemspace lim", ["eo"]="", ["es"]="lím\\sixperemspace proy", + ["hy"]="proj\\sixperemspace lim", ["sk"]="proj\\sixperemspace lim", ["sr"]="proj\\sixperemspace lim", ["sr-latn"]="proj\\sixperemspace lim", @@ -862,6 +921,7 @@ data.labels={ ["en"]="sec", ["eo"]="sek", ["es"]="sec", + ["hy"]="sec", ["mk"]="sec", ["sk"]="sec", ["sr"]="sec", @@ -874,6 +934,7 @@ data.labels={ ["en"]="sin", ["eo"]="sin", ["es"]="sen", + ["hy"]="sin", ["mk"]="sin", ["sk"]="sin", ["sr"]="sin", @@ -886,6 +947,7 @@ data.labels={ ["en"]="sinh", ["eo"]="sinh", ["es"]="senh", + ["hy"]="sinh", ["mk"]="sinh", ["sk"]="sinh", ["sr"]="sinh", @@ -898,6 +960,7 @@ data.labels={ ["en"]="sup", ["eo"]="sup", ["es"]="sup", + ["hy"]="sup", ["mk"]="sup", ["sk"]="sup", ["sr"]="sup", @@ -911,6 +974,7 @@ data.labels={ ["eo"]="tan", ["es"]="tan", ["hr"]="tg", + ["hy"]="tan", ["mk"]="tg", ["pl"]="tg", ["sk"]="tg", @@ -924,6 +988,7 @@ data.labels={ ["en"]="tanh", ["eo"]="tanh", ["es"]="tanh", + ["hy"]="tanh", ["mk"]="tgh", ["sk"]="tgh", ["sr"]="tgh", @@ -949,6 +1014,7 @@ data.labels={ ["gr"]="", ["hr"]=" i ", ["hu"]=" és ", + ["hy"]=" և ", ["it"]="", ["la"]="", ["lt"]="", @@ -991,6 +1057,7 @@ data.labels={ ["gr"]="Παράρτημα ", ["hr"]="Dodatak ", ["hu"]="Melléklet ", + ["hy"]="Հավելված ", ["it"]="", ["ja"]="付録", ["kr"]="부록", @@ -1038,6 +1105,7 @@ data.labels={ ["gr"]="Απρίλιος", ["hr"]="travnja", ["hu"]="április", + ["hy"]="Ապրիլ", ["it"]="aprile", ["ja"]="4", ["kr"]="4", @@ -1066,6 +1134,7 @@ data.labels={ ["labels"]={ ["en"]="Tir", ["fa"]="تیر", + ["hy"]="Տիր", }, }, ["april:mnem"]={ @@ -1085,6 +1154,7 @@ data.labels={ ["gr"]="", ["hr"]="tra", ["hu"]="ápr.", + ["hy"]="Ապր", ["it"]="", ["la"]="", ["lt"]="apr", @@ -1125,6 +1195,7 @@ data.labels={ ["gr"]="", ["hr"]="na stranici ", ["hu"]="oldal ", + ["hy"]="էջում ", ["it"]="a pagina ", ["la"]="", ["lt"]="puslapyje ", @@ -1171,6 +1242,7 @@ data.labels={ ["gr"]="Αύγουστος", ["hr"]="kolovoza", ["hu"]="augusztus", + ["hy"]="Օգոստոս", ["it"]="agosto", ["ja"]="8", ["kr"]="8", @@ -1199,6 +1271,7 @@ data.labels={ ["labels"]={ ["en"]="Aban", ["fa"]="آبان", + ["hy"]="Աբան", }, }, ["august:mnem"]={ @@ -1218,6 +1291,7 @@ data.labels={ ["gr"]="", ["hr"]="kol", ["hu"]="aug.", + ["hy"]="Օգ", ["it"]="", ["la"]="", ["lt"]="aug", @@ -1262,6 +1336,7 @@ data.labels={ ["gr"]="Κεφάλαιο", ["hr"]="Poglavlje ", ["hu"]={ "", " fejezet" }, + ["hy"]="Գլուխ ", ["it"]="", ["ja"]={ "第", "章" }, ["kr"]={ "제", "장" }, @@ -1305,6 +1380,7 @@ data.labels={ ["gr"]="", ["hr"]=" (nastavak)", ["hu"]=" (folytatás)", + ["hy"]=" (շարունակություն)", ["it"]="", ["la"]="", ["lt"]="", @@ -1335,6 +1411,7 @@ data.labels={ ["eo"]="tago", ["et"]="päev", ["fa"]="روز", + ["hy"]="օր", ["kr"]="일", ["mk"]="ден", ["nl"]="dag", @@ -1365,6 +1442,7 @@ data.labels={ ["gr"]="Δεκέμβριος", ["hr"]="prosinca", ["hu"]="december", + ["hy"]="Դեկտեմբեր", ["it"]="dicembre", ["ja"]="12", ["kr"]="12", @@ -1393,6 +1471,7 @@ data.labels={ ["labels"]={ ["en"]="Esfand", ["fa"]="اسفند", + ["hy"]="Էսֆանդ", }, }, ["december:mnem"]={ @@ -1412,6 +1491,7 @@ data.labels={ ["gr"]="", ["hr"]="pro", ["hu"]="dec.", + ["hy"]="Դեկ", ["it"]="", ["la"]="", ["lt"]="dec", @@ -1457,6 +1537,7 @@ data.labels={ ["gr"]="Φεβρουάριος", ["hr"]="veljače", ["hu"]="február", + ["hy"]="Պետրվար", ["it"]="febbraio", ["ja"]="2", ["kr"]="2", @@ -1485,6 +1566,7 @@ data.labels={ ["labels"]={ ["en"]="Ordibehesht", ["fa"]="اردیبهشت", + ["hy"]="Օրդիբեհեշթ", }, }, ["february:mnem"]={ @@ -1504,6 +1586,7 @@ data.labels={ ["gr"]="", ["hr"]="velj", ["hu"]="feb.", + ["hy"]="Փետ", ["it"]="", ["la"]="", ["lt"]="feb", @@ -1547,6 +1630,7 @@ data.labels={ ["gr"]="Σχήμα", ["hr"]="Slika ", ["hu"]={ "", " ábra" }, + ["hy"]="Նկար ", ["it"]="Fig. ", ["ja"]="図", ["kr"]="그림 ", @@ -1577,6 +1661,7 @@ data.labels={ ["en"]="ff.", ["eo"]="sekvv", ["fr"]=hairspace .. "sqq", + ["hy"]="ff.", }, }, ["following:singular"]={ @@ -1585,6 +1670,7 @@ data.labels={ ["en"]="f.", ["eo"]="sekv", ["fr"]=hairspace .. "sq", + ["hy"]="f.", }, }, ["followingpage"]={ @@ -1594,6 +1680,7 @@ data.labels={ ["eo"]="je sekvanta paĝo", ["et"]="järgmisel leheküljel", ["fa"]="در صفحات آینده", + ["hy"]="Հաջորդ էջում", ["mk"]="на следната страница", ["nl"]="op een volgende bladzijde", ["sr"]="на следећој страници", @@ -1621,6 +1708,7 @@ data.labels={ ["gr"]="Παρασκευή", ["hr"]="petak", ["hu"]="péntek", + ["hy"]="ուրբաթ", ["it"]="venerdì", ["ja"]="金曜日", ["kr"]="금요일", @@ -1652,6 +1740,7 @@ data.labels={ ["de"]="Fr.", ["en"]="fri", ["eo"]="ven.", + ["hy"]="Ուրբ", ["sk"]="pi", ["sr"]="пет", ["sr-latn"]="pet", @@ -1678,6 +1767,7 @@ data.labels={ ["gr"]="Γραφικό", ["hr"]="Slika ", ["hu"]={ "", " kép" }, + ["hy"]="Գրաֆ", ["it"]="Grafico ", ["ja"]="イラスト", ["la"]="Typus ", @@ -1721,6 +1811,7 @@ data.labels={ ["gr"]="", ["hr"]="vidi gore", ["hu"]="lásd feljebb", + ["hy"]="ստորև նշված", ["it"]="come mostrato sopra", ["kr"]="그러므로", ["la"]="", @@ -1764,6 +1855,7 @@ data.labels={ ["gr"]="", ["hr"]="vidi ispod", ["hu"]="lásd lejjebb", + ["hy"]="ինչպես ցույց է տրված ստորև", ["it"]="come mostrato sotto", ["kr"]="이후로", ["la"]="", @@ -1807,6 +1899,7 @@ data.labels={ ["gr"]="Παύση", ["hr"]="Intermeco ", ["hu"]={ "", " intermezzo" }, + ["hy"]="Ինտերմեցո", ["it"]="Intermezzo ", ["ja"]="間奏曲", ["kr"]="간주곡", @@ -1854,6 +1947,7 @@ data.labels={ ["gr"]="Ιανουάριος", ["hr"]="siječnja", ["hu"]="január", + ["hy"]="Հունվար", ["it"]="gennaio", ["ja"]="1", ["kr"]="1", @@ -1882,6 +1976,7 @@ data.labels={ ["labels"]={ ["en"]="Farvardin", ["fa"]="فروردین", + ["hy"]="Ֆարվարդին", }, }, ["january:mnem"]={ @@ -1901,6 +1996,7 @@ data.labels={ ["gr"]="", ["hr"]="sij", ["hu"]="jan.", + ["hy"]="Հունվ", ["it"]="", ["la"]="", ["lt"]="jan", @@ -1947,6 +2043,7 @@ data.labels={ ["gr"]="Ιούλιος", ["hr"]="srpnja", ["hu"]="július", + ["hy"]="Հուլիս", ["it"]="luglio", ["ja"]="7", ["kr"]="7", @@ -1975,6 +2072,7 @@ data.labels={ ["labels"]={ ["en"]="Mehr", ["fa"]="مهر", + ["hy"]="Մեհր", }, }, ["july:mnem"]={ @@ -1994,6 +2092,7 @@ data.labels={ ["gr"]="", ["hr"]="srp", ["hu"]="júl.", + ["hy"]="Հուլ", ["it"]="", ["la"]="", ["lt"]="jul", @@ -2039,6 +2138,7 @@ data.labels={ ["gr"]="Ιούνιος", ["hr"]="lipnja", ["hu"]="június", + ["hy"]="Հունիսի", ["it"]="giugno", ["ja"]="6", ["kr"]="6", @@ -2067,6 +2167,7 @@ data.labels={ ["labels"]={ ["en"]="Shahrivar", ["fa"]="شهریور", + ["hy"]="Շահրիվար", }, }, ["june:mnem"]={ @@ -2086,6 +2187,7 @@ data.labels={ ["gr"]="", ["hr"]="lip", ["hu"]="jún.", + ["hy"]="Հուն", ["it"]="", ["la"]="", ["lt"]="jun", @@ -2129,6 +2231,7 @@ data.labels={ ["gr"]="Γραμμή", ["hr"]="redak ", ["hu"]={ "", " sor" }, + ["hy"]="Տող ", ["it"]="riga ", ["ja"]="線", ["kr"]="행", @@ -2174,6 +2277,7 @@ data.labels={ ["gr"]="Γραμμές", ["hr"]="retci ", ["hu"]="sorok ", + ["hy"]="Տողեր ", ["it"]="righe ", ["ja"]="線", ["kr"]="행", @@ -2220,6 +2324,7 @@ data.labels={ ["gr"]="Μάρτιος", ["hr"]="ožujka", ["hu"]="március", + ["hy"]="Մարտ", ["it"]="marzo", ["ja"]="3", ["kr"]="3", @@ -2248,6 +2353,7 @@ data.labels={ ["labels"]={ ["en"]="Khordad", ["fa"]="خرداد", + ["hy"]="Խորդադ", }, }, ["march:mnem"]={ @@ -2267,6 +2373,7 @@ data.labels={ ["gr"]="", ["hr"]="ožu", ["hu"]="már.", + ["hy"]="Մարտ", ["it"]="", ["la"]="", ["lt"]="mar", @@ -2313,6 +2420,7 @@ data.labels={ ["gr"]="Μάιος", ["hr"]="svibnja", ["hu"]="május", + ["hy"]="Մայիս", ["it"]="maggio", ["ja"]="5", ["kr"]="5", @@ -2341,6 +2449,7 @@ data.labels={ ["labels"]={ ["en"]="Mordad", ["fa"]="مرداد", + ["hy"]="Մորդադ", }, }, ["may:mnem"]={ @@ -2360,6 +2469,7 @@ data.labels={ ["gr"]="", ["hr"]="svi", ["hu"]="máj.", + ["hy"]="Մայ", ["it"]="", ["la"]="", ["lt"]="may", @@ -2403,6 +2513,7 @@ data.labels={ ["gr"]="Δευτέρα", ["hr"]="ponedjeljak", ["hu"]="hétfő", + ["hy"]="երկուշաբթի", ["it"]="lunedì", ["ja"]="月曜日", ["kr"]="월요일", @@ -2434,6 +2545,7 @@ data.labels={ ["de"]="Mo.", ["en"]="mon", ["eo"]="lun.", + ["hy"]="Երկ", ["sk"]="po", ["sr"]="пон", ["sr-latn"]="pon", @@ -2448,6 +2560,7 @@ data.labels={ ["eo"]="monato", ["et"]="kuu", ["fa"]="ماه", + ["hy"]="ամիս", ["kr"]="월", ["mk"]="месец", ["nl"]="maand", @@ -2478,6 +2591,7 @@ data.labels={ ["gr"]="Νοέμβριος", ["hr"]="studenog", ["hu"]="november", + ["hy"]="Նոյեմբեր", ["it"]="novembre", ["ja"]="11", ["kr"]="11", @@ -2506,6 +2620,7 @@ data.labels={ ["labels"]={ ["en"]="Bahman", ["fa"]="بهمن", + ["hy"]="Բահման", }, }, ["november:mnem"]={ @@ -2525,6 +2640,7 @@ data.labels={ ["gr"]="", ["hr"]="stu", ["hu"]="nov.", + ["hy"]="Նոյ", ["it"]="", ["la"]="", ["lt"]="nov", @@ -2569,6 +2685,7 @@ data.labels={ ["gr"]="Οκτώβριος", ["hr"]="listopada", ["hu"]="október", + ["hy"]="հոկտեմբեր", ["it"]="ottobre", ["ja"]="10", ["kr"]="10", @@ -2597,6 +2714,7 @@ data.labels={ ["labels"]={ ["en"]="Dey", ["fa"]="دی", + ["hy"]="Դեյ", }, }, ["october:mnem"]={ @@ -2616,6 +2734,7 @@ data.labels={ ["gr"]="", ["hr"]="lis", ["hu"]="okt.", + ["hy"]="Հոկ", ["it"]="", ["la"]="", ["lt"]="oct", @@ -2658,6 +2777,7 @@ data.labels={ ["gr"]="", ["hr"]="stranica ", ["hu"]="oldal ", + ["hy"]="էջ ", ["it"]="pagina ", ["kr"]="쪽", ["la"]="", @@ -2702,6 +2822,7 @@ data.labels={ ["gr"]="Μέρος", ["hr"]="Dio ", ["hu"]={ "", " rész" }, + ["hy"]="Մաս ", ["it"]="Parte ", ["ja"]={ "第", "パート" }, ["kr"]={ "제", "부" }, @@ -2733,6 +2854,7 @@ data.labels={ ["eo"]="sur antaŭa paĝo", ["et"]="eelmisel lehel", ["fa"]="در صفحات گذشته", + ["hy"]="նախորդ էջ", ["mk"]="на претходната страница", ["nl"]="op een voorgaande bladzijde", ["sr"]="на претходној страници", @@ -2760,6 +2882,7 @@ data.labels={ ["gr"]="Σάββατο", ["hr"]="subota", ["hu"]="szombat", + ["hy"]="շաբաթ", ["it"]="sabato", ["ja"]="土曜日", ["kr"]="토요일", @@ -2791,6 +2914,7 @@ data.labels={ ["de"]="Sa.", ["en"]="sat", ["eo"]="sab.", + ["hy"]="Շաբ", ["sk"]="so", ["sr"]="суб", ["sr-latn"]="sub", @@ -2817,6 +2941,7 @@ data.labels={ ["gr"]="Ενότητα", ["hr"]="Odjeljak ", ["hu"]="Fejezet ", + ["hy"]="Բաժին ", ["it"]="", ["ja"]={ "第", "項" }, ["kr"]={ "제", "절" }, @@ -2861,6 +2986,7 @@ data.labels={ ["gr"]="", ["hr"]="vidi ", ["hu"]="lásd ", + ["hy"]="Նայել ", ["it"]="cf. ", ["kr"]="", ["la"]="", @@ -2907,6 +3033,7 @@ data.labels={ ["gr"]="Σεπτέμβριος", ["hr"]="rujna", ["hu"]="szeptember", + ["hy"]="Սեպտեմբեր", ["it"]="settembre", ["ja"]="9", ["kr"]="9", @@ -2935,6 +3062,7 @@ data.labels={ ["labels"]={ ["en"]="Azar", ["fa"]="آذر", + ["hy"]="Ազար", }, }, ["september:mnem"]={ @@ -2954,6 +3082,7 @@ data.labels={ ["gr"]="", ["hr"]="ruj", ["hu"]="szep.", + ["hy"]="Սեպ", ["it"]="", ["la"]="", ["lt"]="sep", @@ -2997,6 +3126,7 @@ data.labels={ ["gr"]="Υπόενότητα", ["hr"]="Pododjeljak ", ["hu"]="Alfejezet ", + ["hy"]=" Ենթաբաժին ", ["it"]="", ["ja"]="", ["la"]="", @@ -3041,6 +3171,7 @@ data.labels={ ["gr"]="", ["hr"]="Podpododjeljak ", ["hu"]="Al-alfejezet ", + ["hy"]="Ենթաենթաբաժին ", ["it"]="", ["ja"]="", ["la"]="", @@ -3085,6 +3216,7 @@ data.labels={ ["gr"]="", ["hr"]="Podpodpododjeljak ", ["hu"]="Al-al-alfejezet ", + ["hy"]="Ենթաենթաենթաբաժին ", ["it"]="", ["ja"]="", ["la"]="", @@ -3129,6 +3261,7 @@ data.labels={ ["gr"]="Κυριακή", ["hr"]="nedjelja", ["hu"]="vasárnap", + ["hy"]="կիրակի", ["it"]="domenica", ["ja"]="日曜日", ["kr"]="일요일", @@ -3160,6 +3293,7 @@ data.labels={ ["de"]="So.", ["en"]="sun", ["eo"]="dim.", + ["hy"]="Կիր", ["sk"]="ne", ["sr"]="нед", ["sr-latn"]="ned", @@ -3186,6 +3320,7 @@ data.labels={ ["gr"]="Πίνακας", ["hr"]="Tablica ", ["hu"]={ "", " táblázat" }, + ["hy"]="Աղյուսակ ", ["it"]="Tabella ", ["ja"]="表", ["kr"]="표 ", @@ -3231,6 +3366,7 @@ data.labels={ ["gr"]="Πέμπτη", ["hr"]="četvrtak", ["hu"]="csütörtök", + ["hy"]="հինգշաբթի", ["it"]="giovedì", ["ja"]="木曜日", ["kr"]="목요일", @@ -3262,6 +3398,7 @@ data.labels={ ["de"]="Do.", ["en"]="thu", ["eo"]="ĵaŭ.", + ["hy"]="Հնգ", ["sk"]="št", ["sr"]="чет", ["sr-latn"]="čet", @@ -3288,6 +3425,7 @@ data.labels={ ["gr"]="Τρίτη", ["hr"]="utorak", ["hu"]="kedd", + ["hy"]="երեքշաբթի", ["it"]="martedì", ["ja"]="火曜日", ["kr"]="화요일", @@ -3319,6 +3457,7 @@ data.labels={ ["de"]="Di.", ["en"]="tue", ["eo"]="mar.", + ["hy"]="Երք", ["sk"]="út", ["sr"]="уто", ["sr-latn"]="uto", @@ -3345,6 +3484,7 @@ data.labels={ ["gr"]="Τετάρτη", ["hr"]="srijeda", ["hu"]="szerda", + ["hy"]="չորեքշաբթի", ["it"]="mercoledì", ["ja"]="水曜日", ["kr"]="수요일", @@ -3376,6 +3516,7 @@ data.labels={ ["de"]="Mi.", ["en"]="wed", ["eo"]="mer.", + ["hy"]="չոր", ["sk"]="st", ["sr"]="сре", ["sr-latn"]="sre", @@ -3389,6 +3530,7 @@ data.labels={ ["eo"]="jaro", ["et"]="aasta", ["fa"]="سال", + ["hy"]="Տարի", ["kr"]="년", ["mk"]="година", ["nl"]="jaar", @@ -3419,6 +3561,7 @@ data.labels={ ["gr"]="Συντομογραφίες", ["hr"]="Kratice", ["hu"]="Rövidítések", + ["hy"]="Հապավումներ", ["it"]="Abbreviazioni", ["ja"]="略語", ["kr"]="약어", @@ -3464,6 +3607,7 @@ data.labels={ ["gr"]="Περιεχόμενα", ["hr"]="Sadržaj", ["hu"]="Tartalom", + ["hy"]="Բովանդակություն", ["it"]="Indice", ["ja"]="目次", ["kr"]="목차", @@ -3508,6 +3652,7 @@ data.labels={ ["gr"]="Σχήματα", ["hr"]="Slike", ["hu"]="Ábrák", + ["hy"]="Նկարազարդումներ", ["it"]="Figure", ["ja"]="図", ["kr"]="그림 ", @@ -3553,6 +3698,7 @@ data.labels={ ["gr"]="Γραφικά", ["hr"]="Slike", ["hu"]="Grafikák", + ["hy"]="Գծապատկեր", ["it"]="Grafici", ["ja"]="グラフ", ["kr"]="그래픽 ", @@ -3598,6 +3744,7 @@ data.labels={ ["gr"]="Ευρετήριο", ["hr"]="Indeks", ["hu"]="Index", + ["hy"]="Այբբենական ցուցիչ", ["it"]="Indice", ["ja"]="目次", ["kr"]="찾아보기", @@ -3642,6 +3789,7 @@ data.labels={ ["gr"]="Παύσεις", ["hr"]="Intermeci", ["hu"]="Intermezzok", + ["hy"]="Ինտերլյուդներ", ["it"]="Intermezzi", ["ja"]="間奏曲", ["kr"]="간주곡", @@ -3687,6 +3835,7 @@ data.labels={ ["gr"]="Λογότυπα", ["hr"]="Logotipi", ["hu"]="Fejlécek", + ["hy"]="Լոգոներ", ["it"]="Logotipi", ["ja"]="理性", ["kr"]="이성", @@ -3728,6 +3877,7 @@ data.labels={ ["gr"]="", ["hr"]="Literatura", ["hu"]="Bibliográfia", + ["hy"]="Գրականութիւն", ["it"]="Bibliografia", ["kr"]="참고문헌", ["la"]="", @@ -3771,6 +3921,7 @@ data.labels={ ["gr"]="Πίνακες", ["hr"]="Tablice", ["hu"]="Táblázatok", + ["hy"]="Աղյուսակներ", ["it"]="Tabelle", ["ja"]="机", ["kr"]="표 ", @@ -3816,6 +3967,7 @@ data.labels={ ["gr"]="Μονάδες", ["hr"]="Jedinice", ["hu"]="Mértékegységek", + ["hy"]="Չափման միավորներ", ["it"]="Unità", ["ja"]="ユニッツ", ["kr"]="측정단위", diff --git a/tex/context/base/mkiv/mtx-context-setters.tex b/tex/context/base/mkiv/mtx-context-setters.tex index 3201ae3ba..c90c385c5 100644 --- a/tex/context/base/mkiv/mtx-context-setters.tex +++ b/tex/context/base/mkiv/mtx-context-setters.tex @@ -24,9 +24,12 @@ \starttext -\doifdocumentargument {trackers} { \ctxlua {trackers .show(environment.arguments.pattern) } } -\doifdocumentargument {directives} { \ctxlua {directives .show(environment.arguments.pattern) } } -\doifdocumentargument {experiments} { \ctxlua {experiments.show(environment.arguments.pattern) } } +\doifdocumentargument {trackers} { \ctxlua {trackers .show(environment.arguments.pattern) } } +\doifdocumentargument {directives} { \ctxlua {directives .show(environment.arguments.pattern) } } +\doifdocumentargument {experiments} { \ctxlua {experiments.show(environment.arguments.pattern) } } +\doifdocumentargument {showtrackers} { \ctxlua {trackers .show(environment.arguments.pattern) } } +\doifdocumentargument {showdirectives} { \ctxlua {directives .show(environment.arguments.pattern) } } +\doifdocumentargument {showexperiments} { \ctxlua {experiments.show(environment.arguments.pattern) } } \stoptext diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua index e4566b7e4..835588e46 100644 --- a/tex/context/base/mkiv/mult-low.lua +++ b/tex/context/base/mkiv/mult-low.lua @@ -112,7 +112,8 @@ return { "applytextitalickernmathcontrolcode", "applyscriptitalickernmathcontrolcode", "checkspaceitalickernmathcontrolcode", "checktextitalickernmathcontrolcode", "analyzescriptnucleuscharmathcontrolcode", "analyzescriptnucleuslistmathcontrolcode", "analyzescriptnucleusboxmathcontrolcode", - "accenttopskewwithoffsetmathcontrolcode", "ignorekerndimensionsmathcontrolcode", + "accenttopskewwithoffsetmathcontrolcode", "ignorekerndimensionsmathcontrolcode", "ignoreflataccentsmathcontrolcode", + "extendaccentsmathcontrolcode", -- "noligaturingglyphoptioncode", "nokerningglyphoptioncode", "noexpansionglyphoptioncode", "noprotrusionglyphoptioncode", "noleftkerningglyphoptioncode", "noleftligaturingglyphoptioncode", "norightkerningglyphoptioncode", "norightligaturingglyphoptioncode", @@ -188,7 +189,7 @@ return { "twoperemspace", "threeperemspace", "fourperemspace", "fiveperemspace", "sixperemspace", "figurespace", "punctuationspace", "hairspace", "enquad", "emquad", "zerowidthspace", "zerowidthnonjoiner", "zerowidthjoiner", "zwnj", "zwj", - "optionalspace", "asciispacechar", "softhyphen", + "optionalspace", "asciispacechar", "softhyphen", "autoinsertedspace", -- "Ux", "eUx", "Umathaccents", -- diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua index 60fb704d4..32b8aa440 100644 --- a/tex/context/base/mkiv/mult-prm.lua +++ b/tex/context/base/mkiv/mult-prm.lua @@ -648,6 +648,7 @@ return { "unletprotected", "untraced", "unvpack", + "variablefam", "vpack", "wordboundary", "wrapuppar", diff --git a/tex/context/base/mkiv/mult-sys.mkiv b/tex/context/base/mkiv/mult-sys.mkiv index 149a7ac24..07ec16e2b 100644 --- a/tex/context/base/mkiv/mult-sys.mkiv +++ b/tex/context/base/mkiv/mult-sys.mkiv @@ -44,6 +44,10 @@ % definesystemconstant {vn} \definesystemconstant {afrikaans} \definesystemconstant {af} +\definesystemconstant {albanian} \definesystemconstant {sq} +\definesystemconstant {armenian} \definesystemconstant {hy} + \definesystemconstant {hye} + \definesystemconstant {hyw} \definesystemconstant {ancientgreek} \definesystemconstant {agr} \definesystemconstant {ancientlatin} \definesystemconstant {ala} \definesystemconstant {arabic} \definesystemconstant {ar} diff --git a/tex/context/base/mkiv/spac-chr.lua b/tex/context/base/mkiv/spac-chr.lua index 233552460..f9b4da31a 100644 --- a/tex/context/base/mkiv/spac-chr.lua +++ b/tex/context/base/mkiv/spac-chr.lua @@ -28,7 +28,10 @@ local nodes, node = nodes, node local nuts = nodes.nuts +local getid = nuts.getid local getboth = nuts.getboth +local getsubtype = nuts.getsubtype +local setsubtype = nuts.setsubtype local getnext = nuts.getnext local getprev = nuts.getprev local getattr = nuts.getattr @@ -37,7 +40,6 @@ local getlanguage = nuts.getlanguage local setchar = nuts.setchar local setattrlist = nuts.setattrlist local getfont = nuts.getfont -local setsubtype = nuts.setsubtype local isglyph = nuts.isglyph local setcolor = nodes.tracers.colors.set @@ -60,10 +62,12 @@ local nodecodes = nodes.nodecodes local gluecodes = nodes.gluecodes local glyph_code = nodecodes.glyph +local glue_code = nodecodes.glue local spaceskip_code = gluecodes.spaceskip local chardata = characters.data -local is_punctuation = characters.is_punctuation +local ispunctuation = characters.is_punctuation +local canhavespace = characters.can_have_space local typesetters = typesetters @@ -182,13 +186,27 @@ local methods = { -- maybe also 0x0008 : backspace + [0x001E] = function(head,current) -- kind of special + local next = getnext(current) + head, current = remove_node(head,current,true) + if next and getid(next) == glue_code and getsubtype(next) == spaceskip_code then + local nextnext = getnext(next) + if nextnext then + local char, font = isglyph(nextnext) + if char and not canhavespace[char] then + remove_node(head,next,true) + end + end + end + end, + [0x001F] = function(head,current) -- kind of special local next = getnext(current) if next then local char, font = isglyph(next) if char then head, current = remove_node(head,current,true) - if not is_punctuation[char] then + if not ispunctuation[char] then local p = fontparameters[font] head, current = insertnodebefore(head,current,new_glue(p.space,p.space_stretch,p.space_shrink)) end diff --git a/tex/context/base/mkiv/spac-chr.mkiv b/tex/context/base/mkiv/spac-chr.mkiv index 9113dc6a1..4c7cc9492 100644 --- a/tex/context/base/mkiv/spac-chr.mkiv +++ b/tex/context/base/mkiv/spac-chr.mkiv @@ -95,7 +95,8 @@ \popoverloadmode -\chardef\optionalspace"1F % will be space unless before punctuation +\chardef\optionalspace "1F % will be space unless before punctuation +\chardef\autoinsertedspace"1E % a more clever \autoinsertspace % Shortcuts: diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex c02ca06bf..13b79a990 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 8c4741da4..bd256d4ec 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/type-set.mkiv b/tex/context/base/mkiv/type-set.mkiv index 269d41966..c87129e94 100644 --- a/tex/context/base/mkiv/type-set.mkiv +++ b/tex/context/base/mkiv/type-set.mkiv @@ -62,9 +62,9 @@ \definefilesynonym [type-imp-latin-modern.mkiv] [type-imp-latinmodern.mkiv] \definefilesynonym [type-imp-modern-latin.mkiv] [type-imp-modernlatin.mkiv] -\definefilesynonym [type-imp-lucida.mkiv] [type-imp-lucida-typeone.mkiv] -\definefilesynonym [type-imp-lucidaot.mkiv] [type-imp-lucida-opentype.mkiv] -\definefilesynonym [type-imp-lucidadk.mkiv] [type-imp-lucida-opentype.mkiv] +\definefilesynonym [type-imp-lucida-opentype.mkiv] [type-imp-lucida.mkiv] +\definefilesynonym [type-imp-lucidaot.mkiv] [type-imp-lucida.mkiv] +\definefilesynonym [type-imp-lucidadk.mkiv] [type-imp-lucida.mkiv] \definefilesynonym [type-imp-dejavu-condensed.mkiv] [type-imp-dejavu.mkiv] diff --git a/tex/context/base/mkxl/char-tex.lmt b/tex/context/base/mkxl/char-tex.lmt index e5ce1c4ab..02d9a6cb6 100644 --- a/tex/context/base/mkxl/char-tex.lmt +++ b/tex/context/base/mkxl/char-tex.lmt @@ -36,7 +36,6 @@ local is_letter = characters.is_letter local is_command = characters.is_command local is_spacing = characters.is_spacing local is_mark = characters.is_mark -local is_punctuation = characters.is_punctuation local data = characters.data if not data then return end local blocks = characters.blocks diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index f890b8877..48532ede6 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.10.22 11:20} +\newcontextversion{2022.11.14 22:54} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 9c7a785f8..d111761b0 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2022.10.22 11:20} +\immutable\edef\contextversion{2022.11.14 22:54} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/font-chk.lmt b/tex/context/base/mkxl/font-chk.lmt index 089e68f9f..05a3611cc 100644 --- a/tex/context/base/mkxl/font-chk.lmt +++ b/tex/context/base/mkxl/font-chk.lmt @@ -379,16 +379,11 @@ local function expandglyph(characters,index,done) if n then d.next = expandglyph(characters,n,done) end - local h = d.hparts - if h then - for i=1,#h do - h[i].glyph = expandglyph(characters,h[i].glyph,done) - end - end - local v = d.vparts - if v then - for i=1,#v do - v[i].glyph = expandglyph(characters,v[i].glyph,done) + local p = d.parts + if p then + for i=1,#p do + local pi = p[i] + pi.glyph = expandglyph(characters,pi.glyph,done) end end return d diff --git a/tex/context/base/mkxl/font-con.lmt b/tex/context/base/mkxl/font-con.lmt index 2e32193e9..daf106a8a 100644 --- a/tex/context/base/mkxl/font-con.lmt +++ b/tex/context/base/mkxl/font-con.lmt @@ -276,6 +276,8 @@ local function scaleparts(parts,delta) return t end +-- getcharactertagvalues + function constructors.scale(tfmdata,specification) local target = { } -- the new table -- @@ -320,20 +322,20 @@ function constructors.scale(tfmdata,specification) -- local mathsize = tonumber(specification.mathsize) or 0 local textsize = tonumber(specification.textsize) or scaledpoints - local forcedsize = tonumber(parameters.mathsize ) or 0 -- can be set by the feature "mathsize" + -- local forcedsize = tonumber(parameters.mathsize ) or 0 -- can be set by the feature "mathsize" local extrafactor = tonumber(specification.factor ) or 1 - if (mathsize == 2 or forcedsize == 2) and parameters.scriptpercentage then - scaledpoints = parameters.scriptpercentage * textsize / 100 - elseif (mathsize == 3 or forcedsize == 3) and parameters.scriptscriptpercentage then - scaledpoints = parameters.scriptscriptpercentage * textsize / 100 - elseif forcedsize > 1000 then -- safeguard - scaledpoints = forcedsize - else - -- in context x and xx also use mathsize - end + -- if (mathsize == 2 or forcedsize == 2) and parameters.scriptpercentage then + -- scaledpoints = parameters.scriptpercentage * textsize / 100 + -- elseif (mathsize == 3 or forcedsize == 3) and parameters.scriptscriptpercentage then + -- scaledpoints = parameters.scriptscriptpercentage * textsize / 100 + -- elseif forcedsize > 1000 then -- safeguard + -- scaledpoints = forcedsize + -- else + -- -- in context x and xx also use mathsize + -- end targetparameters.mathsize = mathsize targetparameters.textsize = textsize - targetparameters.forcedsize = forcedsize + -- targetparameters.forcedsize = forcedsize targetparameters.extrafactor = extrafactor -- local defaultwidth = resources.defaultwidth or 0 @@ -356,6 +358,7 @@ function constructors.scale(tfmdata,specification) -- local askedscaledpoints = scaledpoints local scaledpoints, delta = constructors.calculatescale(tfmdata,scaledpoints,nil,specification) -- no shortcut, dan be redefined +-- print("B",mathsize,askedscaledpoints,scaledpoints,delta) -- local hdelta = delta local vdelta = delta @@ -486,7 +489,7 @@ function constructors.scale(tfmdata,specification) -- local ascender = parameters.ascender if ascender then - targetparameters.ascender = delta * ascender + targetparameters.ascender = delta * ascender end local descender = parameters.descender if descender then @@ -671,6 +674,10 @@ function constructors.scale(tfmdata,specification) if ve then chr.expansion = ve*1000 -- expansionfactor, hm, can happen elsewhere end + local vc = character.compression + if vc then + chr.compression = vc*1000 -- expansionfactor, hm, can happen elsewhere + end local vl = character.leftprotrusion if vl then chr.leftprotrusion = width*vl @@ -682,60 +689,42 @@ function constructors.scale(tfmdata,specification) end -- if hasmath then - -- - -- todo, just operate on descriptions.math local nxt = character.next if nxt then chr.next = nxt end - local vparts = character.vparts - if vparts then - chr.vparts = scaleparts(vparts,vdelta) - end - local hparts = character.hparts - if hparts then - chr.hparts = scaleparts(hparts,hdelta) + local parts = character.parts + if parts then + local orientation = character.partsorientation or "vertical" + chr.parts = scaleparts(parts,orientation == "horizontal" and hdelta or vdelta) + chr.partsorientation = orientation end - local vi = character.vitalic + local vi = character.partsitalic if vi and vi ~= 0 then - chr.vitalic = vi*hdelta + chr.partsitalic = vi*hdelta end --- local va = character.accent --- if va and not chr.topanchor then --- chr.topanchor = va --- end local va = character.topanchor - if va then + if va and va ~= 0 then chr.topanchor = va*vdelta end va = character.bottomanchor - if va then + if va and va ~= 0 then chr.bottomanchor = va*vdelta end - local vo = character.topovershoot - if vo then - chr.topovershoot = vo*hdelta - end - -- vo = character.bottomovershoot - -- if vo then - -- chr.bottomovershoot = vo*hdelta - -- end -- - -- if stackmath then -- not ok yet - local mk = character.mathkerns - if mk then - local tr = mk.topright - local tl = mk.topleft - local br = mk.bottomright - local bl = mk.bottomleft - chr.mathkerns = { - topright = tr and mathkerns(tr,vdelta) or nil, - topleft = tl and mathkerns(tl,vdelta) or nil, - bottomright = br and mathkerns(br,vdelta) or nil, - bottomleft = bl and mathkerns(bl,vdelta) or nil, - } - end - -- end + local mk = character.mathkerns + if mk then + local tr = mk.topright + local tl = mk.topleft + local br = mk.bottomright + local bl = mk.bottomleft + chr.mathkerns = { + topright = tr and mathkerns(tr,vdelta) or nil, + topleft = tl and mathkerns(tl,vdelta) or nil, + bottomright = br and mathkerns(br,vdelta) or nil, + bottomleft = bl and mathkerns(bl,vdelta) or nil, + } + end -- if hasitalics then local vi = character.italic @@ -743,42 +732,46 @@ function constructors.scale(tfmdata,specification) chr.italic = vi*hdelta end end - local vk = character.topleft - if vk and vk ~= 0 then - chr.topleft = vk*hdelta - end - local vk = character.topright - if vk and vk ~= 0 then - chr.topright = vk*hdelta - end - local vk = character.bottomleft - if vk and vk ~= 0 then - chr.bottomleft = vk*hdelta - end - local vk = character.bottomright - if vk and vk ~= 0 then - chr.bottomright = vk*hdelta - end - -- local ft = character.options - -- if ft then - -- chr.options = ft + -- + -- These can never happen here as these come from tweaks but I need to check it: + -- + -- local vo = character.topovershoot + -- if vo and vo ~= 0 then + -- chr.topovershoot = vo*hdelta -- end + -- local il = character.innerlocation + -- if il then + -- chr.innerlocation = il + -- chr.innerxoffset = (character.innerxoffset or 0) * hdelta + -- chr.inneryoffset = (character.inneryoffset or 0) * vdelta + -- end + -- + -- if character.extensible then + -- chr.extensible = true -- stretch fixed width accent + -- end + -- -- + -- local k = character.topleft if k and k ~= 0 then chr.topleft = k*hdelta end + -- local k = character.topright if k and k ~= 0 then chr.topright = k*hdelta end + -- local k = character.bottomleft if k and k ~= 0 then chr.bottomleft = k*hdelta end + -- local k = character.bottomright if k and k ~= 0 then chr.bottomright = k*hdelta end + -- -- + -- local m = character.leftmargin if m and m ~= 0 then chr.leftmargin = m*hdelta end + -- local m = character.rightmargin if m and m ~= 0 then chr.rightmargin = m*hdelta end + -- local m = character.topmargin if m and m ~= 0 then chr.topmargin = m*hdelta end + -- local m = character.bottommargin if m and m ~= 0 then chr.bottommargin = m*hdelta end + -- local sm = character.smaller if sm then chr.smaller = sm end - local mi = character.mirror - if mi then - chr.mirror = mi - end - local fa = character.flataccent + -- local mi = character.mirror + -- if mi then + -- chr.mirror = mi + -- end + local fa = character.flataccent -- set here? if fa then chr.flataccent = fa end - local m = character.leftmargin if m and m ~= 0 then chr.leftmargin = m*hdelta end - local m = character.rightmargin if m and m ~= 0 then chr.rightmargin = m*hdelta end - local m = character.topmargin if m and m ~= 0 then chr.topmargin = m*hdelta end - local m = character.bottommargin if m and m ~= 0 then chr.bottommargin = m*hdelta end elseif autoitalicamount then -- itlc feature local vi = description.italic if not vi then diff --git a/tex/context/base/mkxl/font-ctx.lmt b/tex/context/base/mkxl/font-ctx.lmt index 83c0a912b..23c676e4e 100644 --- a/tex/context/base/mkxl/font-ctx.lmt +++ b/tex/context/base/mkxl/font-ctx.lmt @@ -187,6 +187,12 @@ constructors.noffontsloaded = 0 -- font.getcopy = font.getfont -- we always want the table that context uses +local accuratefactors = false +----- compactfontmode = false + +experiments.register("fonts.accurate", function(v) accuratefactors = v end) +experiments.register("fonts.compact", function() accuratefactors = true end) + do -- Does this still make sense? @@ -1635,8 +1641,11 @@ function constructors.calculatescale(tfmdata,scaledpoints,relativeid,specificati scaledpoints = (- scaledpoints/1000) * (tfmdata.designsize or parameters.designsize) -- already in sp end -- a temp hack till we have upgraded all mechanisms - local delta = round(scaledpoints/units) + local delta = scaledpoints/units local size = round(scaledpoints) + if not accuratefactors then + delta = round(delta) + end texsetcount(c_font_scaled_points,size) -- return size, delta @@ -1662,16 +1671,17 @@ function constructors.hashinstance(specification,force) end specification.size = size if fallbacks then - return hash .. ' @ ' .. size .. ' @ ' .. fallbacks + hash = hash .. ' @ ' .. size .. ' @ ' .. fallbacks else local scalemode = specification.scalemode local special = scalemode and specialscale[scalemode] if special then - return hash .. ' @ ' .. size .. ' @ ' .. special + hash = hash .. ' @ ' .. size .. ' @ ' .. special else - return hash .. ' @ ' .. size + hash = hash .. ' @ ' .. size end end + return hash end -- We overload the (generic) resolver: @@ -2356,7 +2366,7 @@ do end implement { - name = "nbfs", + name = "normalizedbodyfontsize", arguments = "dimen", actions = function(d) context(lpegmatch(stripper,f_strip(d/65536))) diff --git a/tex/context/base/mkxl/font-def.lmt b/tex/context/base/mkxl/font-def.lmt index d71132180..6afeeb474 100644 --- a/tex/context/base/mkxl/font-def.lmt +++ b/tex/context/base/mkxl/font-def.lmt @@ -474,6 +474,7 @@ function definers.read(specification,size,id) -- id can be optional, name can al end specification = definers.resolve(specification) local hash = constructors.hashinstance(specification) +-- inspect(hash) local tfmdata = definers.registered(hash) -- id local name = specification.name if tfmdata then diff --git a/tex/context/base/mkxl/font-imp-quality.lmt b/tex/context/base/mkxl/font-imp-quality.lmt index 93ec1b653..9c57613ee 100644 --- a/tex/context/base/mkxl/font-imp-quality.lmt +++ b/tex/context/base/mkxl/font-imp-quality.lmt @@ -124,6 +124,9 @@ vectors['default'] = { vectors['quality'] = vectors['default'] -- metatable ? +-- Compression is new and used for a math experiment. Musical timestamp(s): November +-- 2022, a cluster of live performances: RPWL (5), PT (7, yes!) and xPropaganda (10). + local function initialize(tfmdata,value) if value then local class, vector = get_class_and_vector(tfmdata,value,"expansions") @@ -159,9 +162,23 @@ local function initialize(tfmdata,value) end end end - if v and v ~= 0 then - chr.expansion = v*factor - else -- can be option + -- So, factor influences all shapes but we now obey zero when set! + if v then + if type(v) == "table" then + local e = v[1] + local c = v[2] or 0 + if e ~= 0 then + chr.expansion = e*factor + end + if c ~= 0 then + chr.compression = c*factor + end + elseif v == 0 then + -- chr.expansion = 0 + else + chr.expansion = v*factor + end + elseif factor ~= 1 then -- test is new chr.expansion = factor end end @@ -194,6 +211,82 @@ implement { actions = function(class,settings) getparameters(classes,class,'preset',settings) end } +-- special version for math 7/11/22 + +classes.math = { + stretch = 2, + shrink = 2, + step = .5, + vector = 'math', + factor = 1, +} + +vectors.math = { + [0x002B] = { 4, 0 }, -- + + [0x2212] = { 4, 0 }, -- - + [0x003C] = { 8, 0 }, -- < + [0x003D] = { 8, 0 }, -- = + [0x003E] = { 8, 0 }, -- > + [0x002F] = { 2, 0 }, -- / + [0x0028] = { 2, 0 }, -- ( + [0x0029] = { 2, 0 }, -- ) + [0x005B] = { 2, 0 }, -- [ + [0x005D] = { 2, 0 }, -- ] +} + +local function initialize(tfmdata,value) + if value then + local class, vector = get_class_and_vector(tfmdata,value,"expansions") + if class then + if vector then + local stretch = class.stretch or 0 + local shrink = class.shrink or 0 + local step = class.step or 0 + local factor = class.factor or 1 + if trace_expansion then + report_expansions("setting class %a, vector %a, factor %a, stretch %a, shrink %a, step %a", + value,class.vector,factor,stretch,shrink,step) + end + tfmdata.parameters.expansion = { + stretch = 10 * stretch, + shrink = 10 * shrink, + step = 10 * step, + factor = factor, + } + local characters = tfmdata.characters + for u, v in next, vector do + local chr = characters[u] + if type(v) == "table" then + local e = v[1] + local c = v[2] or 0 + if e ~= 0 then + chr.expansion = e*factor + end + if c ~= 0 then + chr.compression = c*factor + end + elseif v ~= 0 then + chr.expansion = v*factor + end + end + elseif trace_expansion then + report_expansions("unknown vector %a in class %a",class.vector,value) + end + elseif trace_expansion then + report_expansions("unknown class %a",value) + end + end +end + +registerotffeature { + name = "mathexpansion", + description = "apply hz optimization to math", + initializers = { + base = initialize, + node = initialize, + } +} + -- -- -- -- -- -- -- protrusion -- -- -- -- -- -- diff --git a/tex/context/base/mkxl/font-ini.mklx b/tex/context/base/mkxl/font-ini.mklx index 1fab52386..5e521e263 100644 --- a/tex/context/base/mkxl/font-ini.mklx +++ b/tex/context/base/mkxl/font-ini.mklx @@ -419,11 +419,11 @@ \fi} \def\normalizebodyfontsize_indeed#macro#body% - {\edef#macro{\clf_nbfs\dimexpr#body\relax}% + {\edef#macro{\clf_normalizedbodyfontsize\dimexpr#body\relax}% \gletcsname\??fontnormalizedbody\number\dimexpr#body\endcsname#macro} \permanent\def\thenormalizedbodyfontsize#body% - {\clf_nbfs\dimexpr#body\relax} + {\clf_normalizedbodyfontsize\dimexpr#body\relax} \mutable\edef\normalizedglobalbodyfontsize{\thenormalizedbodyfontsize\bodyfontsize} \mutable\edef\normalizedlocalbodyfontsize {\thenormalizedbodyfontsize\bodyfontsize} @@ -458,12 +458,60 @@ \installcorenamespace{mappedfontsize} -\permanent\tolerant\protected\def\mapfontsize[#from]#spacer[#to]% - {\ifarguments\or\or\defcsname\??mappedfontsize\the\dimexpr#from\relax\endcsname{#to}\fi} +% \permanent\tolerant\protected\def\mapfontsize[#from]#spacer[#to]% +% {\ifarguments\or\or\defcsname\??mappedfontsize\the\dimexpr#from\relax\endcsname{#to}\fi} +% +% \def\font_basics_set_mapped_fontsize#from% +% {\ifcsname\??mappedfontsize\the\dimexpr#from\relax\endcsname +% \lastnamedcs\else#from% +% \fi} + +% will become: mapmathfontsize + +%letcsname\??mappedfontsize\s!text \endcsname\!!plusone +\letcsname\??mappedfontsize\s!script \endcsname\!!plustwo +\letcsname\??mappedfontsize\s!scriptscript\endcsname\!!plusthree + +\permanent\tolerant\protected\def\mapfontsize[#class]#spacer[#from]#spacer[#to]% + {\ifarguments + % ignore + \or + % reset + \letcsname\??mappedfontsize#class:1\endcsname\undefined + \letcsname\??mappedfontsize#class:2\endcsname\undefined + \letcsname\??mappedfontsize#class:3\endcsname\undefined + \or + % unsupported + \or + % set + \defcsname + \??mappedfontsize + #class:% + \begincsname\??mappedfontsize#from\endcsname + \endcsname{#to}% + \fi} + +\permanent\tolerant\protected\def\checkedmapfontsize[#class]#spacer[#from]#spacer[#to]% + {\ifcsname\??mappedfontsize#class:\begincsname\??mappedfontsize#from\endcsname\endcsname + % keep (user) value + \else + \mapfontsize[#class][#from][#to]% + \fi} + +\permanent\tolerant\def\mappedfontsize#class#from% + {\begincsname + \??mappedfontsize + #class:% + \begincsname\??mappedfontsize#from\endcsname + \endcsname} \def\font_basics_set_mapped_fontsize#from% - {\ifcsname\??mappedfontsize\the\dimexpr#from\relax\endcsname - \lastnamedcs\else#from% + {\ifcsname\??mappedfontsize\fontclass:\fontface\endcsname + %\the\dimexpr\lastnamedcs\dimexpr#from\relax\relax + %\the\dimexpr\lastnamedcs\dimexpr\bodyfontsize\relax\relax + \the\dimexpr\lastnamedcs\dimexpr\normalizedbodyfontsize\relax\relax + \else % we could use default + #from% \fi} \installcorenamespace{fontbodyknown} @@ -747,7 +795,7 @@ \d_font_scaled_font_size\v_font_size_absolute\relax \d_font_scaled_font_size\currentfontbodysize\d_font_scaled_font_size % uses \somefontsize set by lua \or - % mo + % mo % mapped font size will go away \d_font_scaled_font_size\font_basics_set_mapped_fontsize\v_font_size_absolute \d_font_scaled_font_size\currentfontbodysize\d_font_scaled_font_size \or @@ -1328,13 +1376,14 @@ \ifcsname\??fontenvironments \normalizedbodyfontsize#parameter\endcsname\lastnamedcs\orelse \ifcsname\??fontenvironments\s!default #parameter\endcsname\lastnamedcs\fi} -% \permanent\def\bodyfontsizevariable#size#parameter% -% {\begincsname\??fontenvironments -% \ifcsname\??fontenvironments\fontclass#size#parameter\endcsname\fontclass#size#parameter\orelse -% \ifcsname\??fontenvironments\fontclass #parameter\endcsname\fontclass #parameter\orelse -% \ifcsname\??fontenvironments #size#parameter\endcsname #size#parameter\orelse -% \ifcsname\??fontenvironments\s!default #parameter\endcsname\s!default #parameter\fi -% \endcsname} +\permanent\def\bodyfontsizevariable#size#parameter% used in s-fonts-show + {\begincsname\??fontenvironments + \ifcsname\??fontenvironments\fontclass#size#parameter\endcsname\fontclass#size#parameter\orelse + \ifcsname\??fontenvironments\fontclass #parameter\endcsname\fontclass #parameter\orelse + \ifcsname\??fontenvironments\v!all #size#parameter\endcsname\v!all #size#parameter\orelse + \ifcsname\??fontenvironments #size#parameter\endcsname #size#parameter\orelse + \ifcsname\??fontenvironments\s!default #parameter\endcsname\s!default #parameter\fi + \endcsname} \def\font_bodyfontvariable#parameter% {\ifcsname\??fontenvironments\fontclass\normalizedbodyfontsize#parameter\endcsname\lastnamedcs\orelse @@ -1669,6 +1718,8 @@ %D Here the rest concerns rl or lr so in this case it is not a size specifier but %D a directional one. +%D no need for the: one two rest + \protected\def\font_basics_define_body_font_nop_mm[#one#two#rest=#value]% local {%\ifcsname\s!mm\endcsname\else\font_basics_check_fontname_combination\s!mm{#one#two}{#rest}\fi \letcsname\??fontinstanceclass\m_font_asked_body-\s!mm-#one#two#rest-1\endcsname\undefined @@ -2366,6 +2417,8 @@ %D math families and finally we activate the default typeface and also set the font %D specific parameters assigned to \type {\everybodyfont}. +% todo: per class + \permanent\protected\def\textface {\currentbodyfontdimension\s!text } \permanent\protected\def\scriptface {\currentbodyfontdimension\s!script } \permanent\protected\def\scriptscriptface{\currentbodyfontdimension\s!scriptscript} diff --git a/tex/context/base/mkxl/font-lib.mklx b/tex/context/base/mkxl/font-lib.mklx index 05367dae8..bb0eec7e6 100644 --- a/tex/context/base/mkxl/font-lib.mklx +++ b/tex/context/base/mkxl/font-lib.mklx @@ -97,8 +97,6 @@ \registerctxluafile{node-fnt}{autosuffix} % here -\registerctxluafile{font-mps}{autosuffix} % outline fun - \registerctxluafile{font-lua}{} \registerctxluafile{font-enh}{autosuffix} diff --git a/tex/context/base/mkxl/font-mat.mklx b/tex/context/base/mkxl/font-mat.mklx index 868f44198..d9337d1b0 100644 --- a/tex/context/base/mkxl/font-mat.mklx +++ b/tex/context/base/mkxl/font-mat.mklx @@ -124,23 +124,26 @@ \mutable\let\fontfamily\relax % for now public but it is a helper -\newconditional\c_math_last_family_set +%newconditional\c_math_last_family_set +\newcount \c_math_last_family_used \def\font_helpers_set_math_family_indeed_normal#mrtag#family% \fontface etc are also used later on {\let\savedfontbody\fontbody \let\fontfamily#family% - \settrue\c_math_last_family_set +% \settrue\c_math_last_family_set +\c_math_last_family_used\zerocount % the order is important as we depend on known id's when completing fonts - % enabling is needed when we have fallbacks which spoils the families + % enabling is needed when we have fallbacks which spoils the families; per + % mid 2022 this is no longer true as we do fallbacks differently \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusthree \font_helpers_set_math_family_a\scriptscriptfont#mrtag\font % defines - \font_helpers_set_math_family_a\scriptscriptfont#mrtag\font % enables + \font_helpers_set_math_family_a\scriptscriptfont#mrtag\font % enables / still needed ? \let\mathsizesuffix\mathscriptsuffix \let\fontface\!!plustwo \font_helpers_set_math_family_a\scriptfont #mrtag\font % defines - \font_helpers_set_math_family_a\scriptfont #mrtag\font % enables + \font_helpers_set_math_family_a\scriptfont #mrtag\font % enables / still needed ? \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone \font_helpers_set_math_family_a\textfont #mrtag\font % defines - \font_helpers_set_math_family_a\textfont #mrtag\font % enables + \font_helpers_set_math_family_a\textfont #mrtag\font % enables / still needed ? \let\mathsizesuffix\empty \let\fontface\!!zerocount \let\fontbody\savedfontbody \setfalse\c_font_auto_size} @@ -160,13 +163,14 @@ \def\font_helpers_set_math_family_indeed_compact#mrtag#family% \fontface etc are also used later on {\let\savedfontbody\fontbody \let\fontfamily#family% - \settrue\c_math_last_family_set +% \settrue\c_math_last_family_set +\c_math_last_family_used\zerocount \font_helpers_set_math_family_set_scales_compact % the order is important as we depend on known id's when completing fonts % enabling is needed when we have fallbacks which spoils the families \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone \font_helpers_set_math_family_a\textfont #mrtag\font % defines - \font_helpers_set_math_family_a\textfont #mrtag\font % enables + \font_helpers_set_math_family_a\textfont #mrtag\font % enables / still needed ? \scriptfont #mrtag\font % reuses \scriptscriptfont#mrtag\font % reuses \let\mathsizesuffix\empty \let\fontface\!!zerocount @@ -185,17 +189,18 @@ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one \let\savedfontbody\fontbody \let\fontfamily#familytag% - \settrue\c_math_last_family_set +% \settrue\c_math_last_family_set +\c_math_last_family_used\zerocount \font_helpers_set_math_family_set_scales_normal \let\mathsizesuffix\mathscriptscriptsuffix\let\fontface\!!plusthree \font_helpers_set_math_family_bold_a\scriptscriptfont#mbfam#mrfam% defines - \font_helpers_set_math_family_bold_a\scriptscriptfont#mbfam#mrfam% enables + \font_helpers_set_math_family_bold_a\scriptscriptfont#mbfam#mrfam% enables / still needed ? \let\mathsizesuffix\mathscriptsuffix \let\fontface\!!plustwo \font_helpers_set_math_family_bold_a\scriptfont #mbfam#mrfam% defines - \font_helpers_set_math_family_bold_a\scriptfont #mbfam#mrfam% enables + \font_helpers_set_math_family_bold_a\scriptfont #mbfam#mrfam% enables / still needed ? \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% defines - \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables + \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables / still needed ? \let\mathsizesuffix\empty \let\fontface\!!zerocount \let\fontbody\savedfontbody \let\defaultfontclass\savedfontclass @@ -206,10 +211,11 @@ \let\defaultfontclass\fontclass % else truefontname falls back on the wrong one \let\savedfontbody\fontbody \let\fontfamily#familytag% - \settrue\c_math_last_family_set +% \settrue\c_math_last_family_set +\c_math_last_family_used\zerocount \let\mathsizesuffix\mathtextsuffix \let\fontface\!!plusone \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% defines - \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables +% \font_helpers_set_math_family_bold_a\textfont #mbfam#mrfam% enables / still needed ? \scriptfont #mbfam\textfont#mbfam% reuses \scriptscriptfont#mbfam\textfont#mbfam% reuses \let\mathsizesuffix\empty \let\fontface\!!zerocount @@ -474,8 +480,18 @@ \mutable\let\bigmathfontsize\empty +% \permanent\protected\def\synchronizebigmath +% {\ifx\bigmathfontsize\fontsize +% % already in sync +% \else +% \let\bigmathfontsize\fontsize +% \font_helpers_synchronize_math +% \fi} + \permanent\protected\def\synchronizebigmath - {\ifx\bigmathfontsize\fontsize + {\ifconditional\c_font_compact + % no need + \orelse\ifx\bigmathfontsize\fontsize % already in sync \else \let\bigmathfontsize\fontsize @@ -501,14 +517,26 @@ %D This is nasty, as the engine only stores the last set family parameters (per style) which %D in our case can be bold. +% \def\font_helpers_synchronize_math_parameters +% {\textfont \zerocount\textfont \zerocount +% \scriptfont \zerocount\scriptfont \zerocount +% \scriptscriptfont\zerocount\scriptscriptfont\zerocount +% \setfalse\c_math_last_family_set} +% +% \appendtoks +% \ifconditional\c_math_last_family_set +% \font_helpers_synchronize_math_parameters +% \fi +% \to\everybodyfont + \def\font_helpers_synchronize_math_parameters - {\textfont \zerocount\textfont \zerocount + {\c_math_last_family_used\mathstylefontid\textstyle\zerocount + \textfont \zerocount\textfont \zerocount \scriptfont \zerocount\scriptfont \zerocount - \scriptscriptfont\zerocount\scriptscriptfont\zerocount - \setfalse\c_math_last_family_set} + \scriptscriptfont\zerocount\scriptscriptfont\zerocount} \appendtoks - \ifconditional\c_math_last_family_set + \ifnum\c_math_last_family_used=\mathstylefontid\textstyle\zerocount\else \font_helpers_synchronize_math_parameters \fi \to\everybodyfont diff --git a/tex/context/base/mkxl/font-otl.lmt b/tex/context/base/mkxl/font-otl.lmt index b7889fc05..2d0d58a97 100644 --- a/tex/context/base/mkxl/font-otl.lmt +++ b/tex/context/base/mkxl/font-otl.lmt @@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.121 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.130 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.pngcache = containers.define("fonts", "png", otf.version, true) @@ -384,46 +384,33 @@ local function copytotfm(data,cache_id) local m = d.math if m then -- - local italic = m.italic - local vitalic = m.vitalic - -- - local variants = m.hvariants - local parts = m.hparts - if variants then - local c = character - for i=1,#variants do - -- local un = variants[i].glyph - local un = variants[i] - c.next = un - c = characters[un] - end -- c is now last in chain - c.hparts = parts - elseif parts then - character.hparts = parts - italic = m.hitalic + local italic = m.italic + if italic and italic ~= 0 then + character.italic = italic end -- - local variants = m.vvariants - local parts = m.vparts + local variants = m.variants + local parts = m.parts + local partsitalic = m.partsitalic + local partsorientation = m.partsorientation if variants then local c = character for i=1,#variants do - -- local un = variants[i].glyph local un = variants[i] c.next = un c = characters[un] end -- c is now last in chain - c.vparts = parts + c.parts = parts + c.partsorientation = partsorientation + if partsitalic and partsitalic ~= 0 then + c.partsitalic = partsitalic + end elseif parts then - character.vparts = parts - end - -- - if italic and italic ~= 0 then - character.italic = italic - end - -- - if vitalic and vitalic ~= 0 then - character.vitalic = vitalic + character.parts = parts + character.partsorientation = partsorientation + if partsitalic and partsitalic ~= 0 then + character.partsitalic = partsitalic + end end -- local topanchor = m.topanchor or m.accent -- for now @@ -678,25 +665,26 @@ local function read_from_otf(specification) return tfmdata end -local function checkmathsize(tfmdata,mathsize) - local mathdata = tfmdata.shared.rawdata.metadata.math - local mathsize = tonumber(mathsize) - if mathdata then -- we cannot use mathparameters as luatex will complain - local parameters = tfmdata.parameters - parameters.scriptpercentage = mathdata.ScriptPercentScaleDown - parameters.scriptscriptpercentage = mathdata.ScriptScriptPercentScaleDown - parameters.mathsize = mathsize -- only when a number ! - end -end - -registerotffeature { - name = "mathsize", - description = "apply mathsize specified in the font", - initializers = { - base = checkmathsize, - node = checkmathsize, - } -} +-- local function checkmathsize(tfmdata,mathsize) +-- local mathdata = tfmdata.shared.rawdata.metadata.math +-- local mathsize = tonumber(mathsize) +-- if mathdata then -- we cannot use mathparameters as luatex will complain +-- local parameters = tfmdata.parameters +-- parameters.scriptpercentage = mathdata.ScriptPercentScaleDown +-- parameters.scriptscriptpercentage = mathdata.ScriptScriptPercentScaleDown +-- parameters.mathsize = mathsize -- only when a number ! +-- -- print(mathdata.ScriptPercentScaleDown,mathdata.ScriptScriptPercentScaleDown) +-- end +-- end +-- +-- registerotffeature { +-- name = "mathsize", +-- description = "apply mathsize specified in the font", +-- initializers = { +-- base = checkmathsize, +-- node = checkmathsize, +-- } +-- } -- readers diff --git a/tex/context/base/mkxl/font-pre.mkxl b/tex/context/base/mkxl/font-pre.mkxl index 4a7442d10..2918a7e8c 100644 --- a/tex/context/base/mkxl/font-pre.mkxl +++ b/tex/context/base/mkxl/font-pre.mkxl @@ -412,6 +412,7 @@ [mode=base, % mode=none, % better, maybe do this last kern=yes, +% kern=force, % flac=yes, % handled differently % liga=yes, % makes no sense % mode=node, @@ -424,6 +425,7 @@ compactmath=yes, flattenaccents=yes, % mathgaps=yes, + mathexpansion=math, language=dflt, script=math] @@ -439,32 +441,32 @@ % \definefontfeature[mathextra][collapseitalics] -\definefontfeature - [mathematics-l2r] - [mathematics] - [] +% \definefontfeature % obsolete +% [mathematics-l2r] +% [mathematics] +% [] -\definefontfeature - [mathematics-r2l] - [mathematics] - [rtlm=yes, - locl=yes] +% \definefontfeature % obsolete +% [mathematics-r2l] +% [mathematics] +% [rtlm=yes, +% locl=yes] -\definefontfeature[virtualmath] [mathematics] -\definefontfeature[virtualmath-l2r] [mathematics-l2r] -\definefontfeature[virtualmath-r2l] [mathematics-r2l] +\definefontfeature[virtualmath] [mathematics] +% \definefontfeature[virtualmath-l2r] [mathematics-l2r] % obsolete +% \definefontfeature[virtualmath-r2l] [mathematics-r2l] % obsolete -\definefontfeature[math-text] [mathematics] [ssty=no] -\definefontfeature[math-script] [mathematics] [ssty=1,mathsize=yes] -\definefontfeature[math-scriptscript] [mathematics] [ssty=2,mathsize=yes] +\definefontfeature[math-text] [mathematics] % [ssty=no] +\definefontfeature[math-script] [mathematics] [ssty=1,mathsize=yes] +\definefontfeature[math-scriptscript] [mathematics] [ssty=2,mathsize=yes] -\definefontfeature[math-text-l2r] [mathematics-l2r] [ssty=no] -\definefontfeature[math-script-l2r] [mathematics-l2r] [ssty=1,mathsize=yes] -\definefontfeature[math-scriptscript-l2r] [mathematics-l2r] [ssty=2,mathsize=yes] +% \definefontfeature[math-text-l2r] [mathematics-l2r] [ssty=no] % obsolete +% \definefontfeature[math-script-l2r] [mathematics-l2r] [ssty=1,mathsize=yes] % obsolete +% \definefontfeature[math-scriptscript-l2r] [mathematics-l2r] [ssty=2,mathsize=yes] % obsolete -\definefontfeature[math-text-r2l] [mathematics-r2l] [ssty=no] -\definefontfeature[math-script-r2l] [mathematics-r2l] [ssty=1,mathsize=yes] -\definefontfeature[math-scriptscript-r2l] [mathematics-r2l] [ssty=2,mathsize=yes] +% \definefontfeature[math-text-r2l] [mathematics-r2l] [ssty=no] % obsolete +% \definefontfeature[math-script-r2l] [mathematics-r2l] [ssty=1,mathsize=yes] % obsolete +% \definefontfeature[math-scriptscript-r2l] [mathematics-r2l] [ssty=2,mathsize=yes] % obsolete % this will go away: could be a mode in the engine % diff --git a/tex/context/base/mkxl/font-set.mklx b/tex/context/base/mkxl/font-set.mklx index 98e2e96e1..631c4af05 100644 --- a/tex/context/base/mkxl/font-set.mklx +++ b/tex/context/base/mkxl/font-set.mklx @@ -43,10 +43,14 @@ % \clf_resetnullfont % in luatex 0.70 this will also do the previous % \glet\font_preloads_reset_nullfont\relax} +% \def\font_preload_check_mode +% {\doifelsemode{lmmath} +% {\def\m_font_fallback_name{modern-designsize-virtual}}% this will stay +% {\def\m_font_fallback_name{modern-designsize}}% % this might become 'modern' +% \glet\font_preload_check_mode\relax} + \def\font_preload_check_mode - {\doifelsemode{lmmath} - {\def\m_font_fallback_name{modern-designsize-virtual}}% this will stay - {\def\m_font_fallback_name{modern-designsize}}% % this might become 'modern' + {\def\m_font_fallback_name{modern}% \glet\font_preload_check_mode\relax} \def\font_preload_default_fonts diff --git a/tex/context/base/mkxl/lang-def.mkxl b/tex/context/base/mkxl/lang-def.mkxl index 2be05104f..cd5fd4ba3 100644 --- a/tex/context/base/mkxl/lang-def.mkxl +++ b/tex/context/base/mkxl/lang-def.mkxl @@ -284,6 +284,23 @@ \c!leftquotation=\rightguillemot, \c!rightquotation=\leftguillemot, \c!date={\v!day,{.},\space,\v!month,\space,\v!year}] + +\installlanguage + [\s!hy] + [\c!spacing=\v!packed, + \c!leftsentence=\endash, % *sentences not confirmed + \c!rightsentence=\endash, + \c!leftsubsentence=\endash, + \c!rightsubsentence=\endash, + \c!leftquote=\guilsingleleft, + \c!rightquote=\guilsingleright, + \c!leftquotation=\leftguillemot + \c!rightquotation=\rightguillemot + \c!date={\v!day,\space,\v!month,\space,\v!year}, % word + % \c!date={\v!day,{.},\v!month,{.},\v!year}, % numbers + \s!patterns=\s!hy, + \s!lefthyphenmin=2, + \s!righthyphenmin=2] \installlanguage [\s!polish] [\s!pl] \installlanguage [\s!czech] [\s!cs] @@ -292,6 +309,10 @@ \installlanguage [\s!slovenian] [\s!sl] \installlanguage [slovene] [\s!sl] % both possible (mojca: still needed?) \installlanguage [\s!albanian] [\s!sq] +\installlanguage [\s!armenian] [\s!hy] + +\installlanguage [\s!hye] [\s!hy] % Eastern Armenian +\installlanguage [\s!hyw] [\s!hy] % Western Armenian % Cyrillic Languages diff --git a/tex/context/base/mkxl/lang-rep.lmt b/tex/context/base/mkxl/lang-rep.lmt index 6139a03f7..fcaff523a 100644 --- a/tex/context/base/mkxl/lang-rep.lmt +++ b/tex/context/base/mkxl/lang-rep.lmt @@ -181,7 +181,7 @@ local function tonodes(list,template) return head end -local is_punctuation = characters.is_punctuation +local ispunctuation = characters.is_punctuation -- We can try to be clever and use the fact that there is no match to skip -- over to the next word but it is gives fuzzy code so for now I removed @@ -326,7 +326,7 @@ function replacements.handler(head) tree = trees[a] if tree then local char = getchar(current) - local punc = is_punctuation[char] + local punc = ispunctuation[char] if mode == "punc" then if not punc then if root then diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt index d937e3dea..57f5b6037 100644 --- a/tex/context/base/mkxl/lpdf-lmt.lmt +++ b/tex/context/base/mkxl/lpdf-lmt.lmt @@ -238,7 +238,7 @@ lpdf.usedindices = usedindices -- [streamhash][index] -> realindex (can local horizontalmode = true local scalefactor = 1 local threshold = 655360 -local thresfactor = 100 +----- thresfactor = 100 local tjfactor = 100 / 65536 function flushers.updatefontstate(font) @@ -690,7 +690,7 @@ do local trace_threshold = false trackers.register("backends.pdf.threshold", function(v) trace_threshold = v end) - -- local f_skip = formatters["%.2N"] + ----- f_skip = formatters["%.2N"] -- I will redo this mess ... we no longer have the mkiv pdf generator that we used in -- luatex (a precursor to lmtx and also for comparison) but only in lmtx now so ... @@ -776,7 +776,7 @@ do move = calc_pdfpos(pos_h,pos_v) end if move then - local d = tj_delta * scalefactor / f_x_scale + local d = tj_delta * scalefactor / (tmef * f_x_scale) if d <= -0.5 or d >= 0.5 then if mode == "char" then end_charmode() @@ -1504,8 +1504,19 @@ local flushimage do local dim_h = size_h * bpfactor local dim_v = size_v * bpfactor local rule - - if dim_v <= one_bp then + -- + -- this fails for showglyphs so and i have no reason to look into it now and rectangles + -- do a better job anyway + -- + if subtype == outlinerule_code then + local linewidth = getdata(current) + pdf_set_pos_temp(pos_h,pos_v) + if linewidth > 0 then + rule = f_w(linewidth * bpfactor,dim_h,dim_v) + else + rule = f_o(dim_h,dim_v) + end + elseif dim_v <= one_bp then pdf_set_pos_temp(pos_h,pos_v + 0.5 * size_v) rule = f_v(dim_v,dim_h) elseif dim_h <= one_bp then @@ -1513,16 +1524,7 @@ local flushimage do rule = f_h(dim_h,dim_v) else pdf_set_pos_temp(pos_h,pos_v) - if subtype == outlinerule_code then - local linewidth = getdata(current) - if linewidth > 0 then - rule = f_w(linewidth * bpfactor,dim_h,dim_v) - else - rule = f_o(dim_h,dim_v) - end - else - rule = f_f(dim_h,dim_v) - end + rule = f_f(dim_h,dim_v) end b = b + 1 ; buffer[b] = rule diff --git a/tex/context/base/mkxl/math-act.lmt b/tex/context/base/mkxl/math-act.lmt index 713635583..c18dcda29 100644 --- a/tex/context/base/mkxl/math-act.lmt +++ b/tex/context/base/mkxl/math-act.lmt @@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['math-act'] = { -- have been removed (no longer viable) but can be found in the .lua variant. local type, next, tonumber = type, next, tonumber -local fastcopy, copytable, insert, remove = table.fastcopy, table.copy, table.insert, table.remove +local fastcopy, copytable, insert, remove, concat = table.fastcopy, table.copy, table.insert, table.remove, table.concat local formatters = string.formatters local byte = string.byte local setmetatableindex, sortedkeys, sortedhash = table.setmetatableindex, table.sortedkeys, table.sortedhash @@ -24,6 +24,7 @@ local report_math = logs.reporter("mathematics","initializing") local report_mathtweak = logs.reporter("mathematics","tweak") local getfontoffamily = tex.getfontoffamily +local texget = tex.get local fontcharacters = fonts.hashes.characters local chardata = characters.data local extensibles = mathematics.extensibles @@ -245,8 +246,22 @@ end -- a couple of predefined tweaks: -local mathtweaks = { } -mathematics.tweaks = mathtweaks +local datasets = { } +local mathtweaks = { datasets = datasets } +mathematics.tweaks = mathtweaks + +-- can be a common helper: + +local f_u = formatters["%U"] + +local function unicodecharlist(t) + local r = { } + local n = 0 + for u in sortedhash(t) do + n = n + 1 ; r[n] = f_u(u) + end + return concat(r," ") +end local function report_tweak(fmt,target,original,...) if fmt then @@ -269,6 +284,16 @@ local function report_tweak(fmt,target,original,...) end end +local function feedback_tweak(tweak,target,original,done) + if not done or (type(done) == "table" and not next(done)) then +if trace_tweaking then -- for now + report_tweak("no need for %a",target,original,tweak) +end + elseif trace_tweaking then + report_tweak("tweak %a applied to: %s",target,original,tweak,unicodecharlist(done)) + end +end + mathtweaks.subsets = { acenorsuvxz = { 0x1D44E, 0x1D450, 0x1D452, 0x1D45B, 0x1D45C, 0x1D45F, 0x1D460, 0x1D462, 0x1D463, 0x1D465, 0x1D467 }, bhklt = { 0x1D44F, 0x1D455, 0x1D458, 0x1D459, 0x1D461 }, @@ -341,7 +366,7 @@ local detail do c = characters[nxt] nxt = c.next end - c = c.hparts or c.vparts + c = c.parts if c then local index = t[3] if index == "*" then @@ -414,6 +439,12 @@ do t = type(v) end if t == "table" and next(v) then + + local axis = tonumber(v.axis) + if axis then + axis = target.mathparameters.AxisHeight * axis + end + local factor = v.factor if factor then local m = v @@ -490,6 +521,13 @@ do if yoffsetfactor then character.yoffset = yoffsetfactor * total end + + if axis then + character.height = (character.height or 0) - axis + character.depth = (character.depth or 0) + axis + character.yoffset = (character.yoffset or 0) + axis + end + if italicfactor then if italic then character.italic = italicfactor * italic @@ -533,7 +571,7 @@ do if nxt then adapt(list,target,original,targetcharacters,originalcharacters,nxt,v,compact,n) else - local parts = character.hparts + local parts = character.parts if parts then for i=1,#parts do adapt(list,target,original,targetcharacters,originalcharacters,parts[i],v,compact,n) @@ -621,25 +659,24 @@ do -- local originalcharacters = original.characters local count = 0 -- local also = getalso(target,original) - -- local done = { } + local done = false for k, v in sortedhash(list) do local ori = targetcharacters[k] local nxt = ori.next local cnt = v if nxt then - local hpt, vpt + local prt = nil local lst = { } while nxt do local chr = targetcharacters[nxt] lst[#lst+1] = chr nxt = chr.next if not nxt then - hpt = chr.hparts - vpt = chr.vparts + prt = chr.parts break end end - if hpt or vpt then + if prt then count = count + 1 if cnt ~= "*" then if #lst < cnt then @@ -647,15 +684,18 @@ do end ori = lst[cnt] end - ori.hparts = hpt - ori.vparts = vpt - -- ori.next = nil -- so we keep the chain + ori.parts = prt + end + if not trace_tweaking then + done = true + elseif done then + done[k] = true + else + done = { [k] = true } end end end - if trace_tweaking and count > 0 then - report_tweak("%i variants wiped",target,original,count) - end + feedback_tweak("wipevariants",target,original,done) end end @@ -663,7 +703,7 @@ end do - function mathtweaks.replacements(target,original,parameters) + function mathtweaks.replace(target,original,parameters) local list = parameters.list if list then local targetcharacters = target.characters @@ -687,7 +727,7 @@ do end end - function mathtweaks.substitutes(target,original,parameters) + function mathtweaks.substitute(target,original,parameters) local list = parameters.list if list then local targetcharacters = target.characters @@ -707,9 +747,6 @@ do end end - mathtweaks.replace = mathtweaks.replacements - mathtweaks.substitute = mathtweaks.substitutes - end do @@ -721,7 +758,7 @@ do if list then local targetcharacters = target.characters local originalcharacters = original.characters - local count = 0 + local done = false local function add(v,n) local chardata = targetcharacters[mathgaps[n] or n] @@ -735,7 +772,13 @@ do local t = mathgaps[nn] or nn if t then kerns[t] = vv * width - count = count + 1 + if not trace_tweaking then + done = true + elseif done then + done[t] = true + else + done = { [t] = true } + end end end) end @@ -768,9 +811,7 @@ do -- end -- end - if trace_tweaking and count > 0 then - report_tweak("%i kern pairs",target,original,count) - end + feedback_tweak("kernpairs",target,original,done) end end @@ -1038,65 +1079,67 @@ do end -do - - function mathtweaks.fixanchors(target,original,parameters) - local targetcharacters= target.characters - local factor = tonumber(parameters.factor) or 0 - if factor ~= 0 then - local count = 0 - for k, v in next, targetcharacters do - local a = v.topanchor - if a and a > 0 then - v.topanchor = a * factor - count = count + 1 - end - end - if trace_tweaking and count > 0 then - report_tweak("%i top anchors fixed",target,original,count) - end - end - end - - mathtweaks.fixaccents = mathtweaks.fixanchors - -end - -do - - -- actually this should be a an engine feature driven by category because we don't - -- want this in display mode .. only a test for MS and HH +-- do +-- +-- function mathtweaks.fixanchors(target,original,parameters) +-- local targetcharacters= target.characters +-- local factor = tonumber(parameters.factor) or 0 +-- if factor ~= 0 then +-- local done = false +-- for k, v in next, targetcharacters do +-- local a = v.topanchor +-- if a and a > 0 then +-- v.topanchor = a * factor +-- count = count + 1 +-- if not trace_tweaking then +-- done = true +-- elseif done then +-- done[u] = true +-- else +-- done = { [u] = true } +-- end +-- end +-- end +-- end +-- feedback_tweak("fixanchors",target,original,done) +-- end +-- +-- end +-- do +-- +-- -- actually this should be a an engine feature driven by category because we don't +-- -- want this in display mode .. only a test for MS and HH +-- -- local issymbol = characters.is_symbol -- -- function mathtweaks.oldstylemath(target,original,parameters) --- local chardata = characters.data +-- local chardata = characters.data -- local characters = target.characters -- local axis = target.mathparameters.AxisHeight -- local delta = (parameters.factor or .1) * axis -- target.mathparameters.AxisHeight = (axis - delta) -- for k, v in sortedhash(characters) do -- if issymbol[k] then -- quick hack, engine knows --- print("old style math",k,chardata[k].description) -- v.yoffset = -delta -- v.height = (v.height or 0) - delta -- v.depth = (v.depth or 0) - delta -- end -- end -- end - - function mathtweaks.oldstylemath(target,original,parameters) - -- not relevant - end - -end +-- +-- function mathtweaks.oldstylemath(target,original,parameters) +-- -- not relevant +-- end +-- +-- end do function mathtweaks.simplifykerns(target,original,parameters) local characters = target.characters - local simplified = 0 - for k, v in sortedhash(characters) do + local done = false + for u, v in sortedhash(characters) do local mathkerns = v.mathkerns if mathkerns then local k = mathkerns.topleft @@ -1128,25 +1171,28 @@ do end end v.mathkerns = nil - simplified = simplified + 1 + if not trace_tweaking then + done = true + elseif done then + done[u] = true + else + done = { [u] = true } + end end end - if simplified == 0 then - report_tweak("no need to simplify mathkerns",target,original) - elseif trace_tweaking then - report_tweak("%i mathkerns simplified",target,original,simplified) - end + feedback_tweak("simplifykerns",target,original,done) end end do - local function wipe(target,original,parameters,field,move,integrals) + local function wipe(whatever,target,original,parameters,field,move,integrals) local targetcharacters = target.characters local targetdescriptions = target.descriptions local factor = target.parameters.factor local correct = parameters.correct + local done = false local function getllx(u) local d = targetdescriptions[u] if d then @@ -1172,7 +1218,7 @@ do goto smaller end else - local done = false + local okay = false local italic = c.italic if move and not c.advance then -- advance check prevents double move local width = c.width or 0 @@ -1187,39 +1233,41 @@ do if topanchor then c.topanchor = topanchor + llx end - c.bottomleft = (c.bottomleft or 0) - llx - c.topleft = (c.topleft or 0) - llx - done = true + -- too bad (schola e^x): + -- c.bottomleft = (c.bottomleft or 0) - llx + -- c.topleft = (c.topleft or 0) - llx + okay = true end end if italic and italic ~= 0 then c.width = width + italic c.bottomright = - italic - done = true + okay = true else c.width = width end end if italic then c.italic = nil - done = true + okay = true end - if not done then - goto smaller - end - end - if trace_tweaking then - if l then - report_tweak("%s %a in range %a from %C","removing",target,original,field,l,s) + if okay then + if not trace_tweaking then + done = true + elseif done then + done[u] = true + else + done = { [u] = true } + end else - report_tweak("%s %a from %C","removing",target,original,field,s) + goto smaller end end goto smaller ::smaller:: s = c.smaller ::variants:: - -- no italics here anyway butr we could check them some day + -- no italics here anyway but we could check them some day else break end @@ -1262,22 +1310,21 @@ do end end end + feedback_tweak(whatever,target,original,done) end function mathtweaks.wipeanchors(target,original,parameters) - wipe(target,original,parameters,"topanchor") + wipe("wipeanchors",target,original,parameters,"topanchor") end - mathtweaks.wipeaccents = mathtweaks.wipeanchors - function mathtweaks.wipeitalics(target,original,parameters) if not checkitalics then - wipe(target,original,parameters,"italic") + wipe("wipeitalics",target,original,parameters,"italic") end end function mathtweaks.moveitalics(target,original,parameters) - wipe(target,original,parameters,"italic",true) + wipe("moveitalics",target,original,parameters,"italic",true) end -- function mathtweaks.fixdigits(target,original,parameters) @@ -1292,7 +1339,8 @@ do local characters = target.characters local list = parameters.list if list then - for k, v in sortedhash(list) do + local done = false + for u, v in sortedhash(list) do local c = characters[k] if c then local w = c.width @@ -1301,15 +1349,20 @@ do if trace_tweaking then -- todo end + if not trace_tweaking then + done = true + elseif done then + done[u] = true + else + done = { [u] = true } + end end end end - -- todo: small + feedback_tweak("topanchors",target,original,done) end end - mathtweaks.topaccents = mathtweaks.topanchors - function mathtweaks.movelimits(target,original,parameters) local characters = target.characters local list = parameters.list @@ -1346,6 +1399,27 @@ do if n then relocate(n,factor) end + -- Kind of tricky: we configure the engine to use the vitalic + -- so when we tweak we need to set that to zero. + local parts = c.parts + local italic = c.partsitalic + if parts and italic then + if italic ~= 0 then + local tchar = characters[parts[#parts].glyph] + local bchar = characters[parts[1].glyph] + local width = tchar.width or 0 + local half = (italic/2) * factor + tchar.topanchor = width + half + bchar.bottomanchor = width - half + bchar.bottomright = - italic + if trace_tweaking then + -- todo + end + tchar.italic = nil + bchar.italic = nil + end + c.vitalic = nil + end if also then local a = also[u] if a then @@ -1365,9 +1439,7 @@ do relocate(k,tonumber(v) or factor) end end - if not next(done) then - report_tweak("no need to move limits",target,original) - end + feedback_tweak("movelimits",target,original,done) end end @@ -1544,6 +1616,8 @@ do }, } + datasets.accentdimensions = candidates + local function adapt(c,factor,baseheight,basedepth) -- if not c.tweaked then local height = c.height or 0 @@ -1593,7 +1667,7 @@ do nv = nv + 1 nc = c.next if not nc then - local hv = c.hparts + local hv = c.parts if hv then for i=1,#hv do local c = characters[hv[i].glyph] @@ -1656,7 +1730,7 @@ do -- depth = 0, -- unicode = 0x203E, -- commands = { { "rule", height, width } }, - -- hparts = { + -- parts = { -- { advance = width, ["end"] = step, glyph = 0x203E, start = 0 }, -- { advance = width, ["end"] = 0, glyph = 0x203E, start = step, extender = 1 }, -- } @@ -1668,7 +1742,7 @@ do -- yoffset = -depth, -- unicode = 0x0332, -- commands = { { "rule", height, width } }, - -- hparts = { + -- parts = { -- { advance = width, ["end"] = step, glyph = 0x0332, start = 0 }, -- { advance = width, ["end"] = 0, glyph = 0x0332, start = step, extender = 1 }, -- } @@ -1687,7 +1761,7 @@ do yoffset = - thickness / 2, unicode = 0x203E, commands = { { "rule", thickness, width } }, - hparts = { + parts = { { advance = width, ["end"] = step, glyph = 0x203E, start = 0 }, { advance = width, ["end"] = 0, glyph = 0x203E, start = step, extender = 1 }, } @@ -1714,7 +1788,7 @@ do depth = double, unicode = 0x23B4, commands = { { "rule", thickness, width } }, - hparts = { + parts = { { advance = thickness, glyph = tpiece, ["end"] = 0, start = half }, { advance = width, glyph = 0x203E, ["end"] = step, start = step, extender = 1 }, { advance = thickness, glyph = tpiece, ["end"] = half, start = 0 }, @@ -1735,7 +1809,7 @@ do depth = half, unicode = 0x23B5, commands = { { "rule", thickness, width } }, - hparts = { + parts = { { advance = thickness, glyph = bpiece, ["end"] = 0, start = half }, { advance = width, glyph = 0x203E, ["end"] = step, start = step, extender = 1 }, { advance = thickness, glyph = bpiece, ["end"] = half, start = 0 }, @@ -1776,13 +1850,12 @@ do while chardata.next do chardata = characters[chardata.next] end --- if chardata and (force or not chardata.hparts) then - if chardata and (force or overloads[unicode] == false or not chardata.hparts) then + if chardata and (force or overloads[unicode] == false or not chardata.parts) then if not list then - chardata.hparts = nil -- when we test + chardata.parts = nil -- when we test else local overload = overloads[unicode] - local hparts = { } + local parts = { } for i=1,#list do local part = list[i] local glyph = part.glyph or unicode @@ -1797,7 +1870,7 @@ do local width = characters[glyph].width local step = width/2 if part.extensible then - hparts[#hparts+1] = { + parts[#parts+1] = { advance = width, glyph = glyph, ["end"] = step, @@ -1805,7 +1878,7 @@ do extender = 1, } else - hparts[#hparts+1] = { + parts[#parts+1] = { advance = width, glyph = glyph, ["end"] = 0, @@ -1813,8 +1886,8 @@ do } end end - if #hparts == #list then - chardata.hparts = hparts + if #parts == #list then + chardata.parts = parts end end end @@ -1886,6 +1959,8 @@ do } end + datasets.addarrows = { } + function mathtweaks.addarrows(target,original,parameters) local overloads = parameters.list or { } -- { [unicode] = { left = .1, right = .1 } } local left = parameters.left or 0.05 @@ -1896,6 +1971,10 @@ do for unicode, list in sortedhash(arrows) do create(target,unicode,list,overloads) end + datasets.addarrows = sortedkeys(arrows) + if trace_tweaking then + report_tweak("arrows added",target,original) + end end end @@ -1915,7 +1994,7 @@ do -- this could be combined with the previous local sequence = data.sequence local horizontal = data.horizontal if sequence then - local parts = horizontal and source.hparts or source.vparts + local parts = source.parts if parts then local p = { } for i=1,#sequence do @@ -1943,7 +2022,7 @@ do -- this could be combined with the previous end end if #p > 0 then - target[horizontal and "hparts" or "vparts"] = p + target.parts = p end end end @@ -1982,6 +2061,8 @@ do { 0x205F, "s", 1/2 }, -- math thinspace } + datasets.checkspacing = list + function mathtweaks.checkspacing(target,original,parameters) local characters = target.characters local parameters = target.parameters @@ -2073,6 +2154,32 @@ do end end + local function fix(target,original,characters,u,l) + local data = characters[u] + if data then + data.innerlocation = l.location == "right" and 2 or 1 + data.innerxoffset = (l.hfactor or 1) * (data.width or 0) + data.inneryoffset = (l.vfactor or 1) * ((data.height or 0) + (data.depth or 0)) + end + end + + function mathtweaks.radicaldegreeanchors(target,original,parameters) + local list = parameters.list + if list then + local characters = target.characters + for unicode, l in sortedhash(list) do -- resolve variants + local u = detail(characters,unicode) or unicode + if type(u) == "table" then + for i=1,#u do + fix(target,original,characters,u[i],l) + end + else + fix(target,original,characters,u,l) + end + end + end + end + end do @@ -2137,15 +2244,48 @@ do done = nil end + -- After the next one I rewarded myself by (again) watching Joe Parrish interpretation + -- of Shostakovich 10 Mvmt. II - Metal several times (video on yt, track on bandcamp) + -- ... timestamp: awaiting the new Albion (Official) single; their work comes in parts. + + function mathtweaks.fixintegrals(target,original,parameters) + local characters = target.characters + local integral = characters[0x222B] + if integral and not integral.parts then + local top = characters[0x2320] + local mid = characters[0x23AE] + local bot = characters[0x2321] + if top and mid and bot then + top = top.height + mid = mid.height + bot = bot.height + integral.partsitalic = integral.italic + integral.parts = { + { advance = bot, ["end"] = bot/3, glyph = 0x2321, start = bot/3 }, + { advance = mid, ["end"] = mid/2, glyph = 0x23AE, start = mid/2, extender = 1 }, + { advance = top, ["end"] = top/3, glyph = 0x2320, start = top/3 }, + } + if trace_tweaking then + report_tweak("fixing the integral extensible",target,original) + end + end + else + report_tweak("no need to fix the integral extensible",target,original) + end + end + end do local list = { 0x2061, 0x2062, 0x2063, 0x2064 } + datasets.wipecues = list + function mathtweaks.wipecues(target,original,parameters) local characters = target.characters local tobewiped = parameters.list or list + local done = false for i=1,#tobewiped do local unicode = tobewiped[i] characters[unicode] = { @@ -2154,10 +2294,15 @@ do depth = 0, unicode = unicode, } - if trace_tweaking then - report_tweak("character %U has been wiped",target,original,unicode) + if not trace_tweaking then + done = true + elseif done then + done[unicode] = true + else + done = { [unicode] = true } end end + feedback_tweak("wipecues",target,original,done) end end @@ -2168,48 +2313,62 @@ do [0x002F] = 0x2044, } + datasets.fixslashes = mapping + function mathtweaks.fixslashes(target,original,parameters) local characters = target.characters + -- local done = false for normal, weird in sortedhash(mapping) do local normalone = characters[normal] local weirdone = characters[weird] if normalone and weirdone and not normalone.next then normalone.next = weirdone.next - if trace_tweaking then - report_tweak("extensibles from %U used for %U",target,original,weird,normal) - end + -- if not trace_tweaking then + -- done = true + -- elseif done then + -- done[normal] = true + -- else + -- done = { [normal] = true } + -- end end weirdone = copytable(normalone) characters[weird] = weirdone weirdone.unicode = weird end - end + -- feedback_tweak("fixslashes",target,original,done) + if trace_tweaking then + report_tweak("slashes fixed",target,original) + end + end end do -- see pagella for an extensive example + local nps = fonts.helpers.newprivateslot + local mapping = { - [0x0300] = { 0x0060, false }, -- aliases can be a table - [0x0308] = { 0x00A8, false }, - [0x0304] = { 0x00AF, false }, - [0x0301] = { 0x00B4, false }, - [0x0302] = { 0x02C6, true }, - [0x030C] = { 0x02C7, true }, - [0x0306] = { 0x02D8, false }, - [0x0307] = { 0x02D9, false }, - [0x030A] = { 0x02DA, false }, - [0x0303] = { 0x02DC, true }, - [0x20DB] = { 0x20DB, false }, + [0x0300] = { 0x0060, false, nps("flat 0x0060 1") }, + [0x0308] = { 0x00A8, false, nps("flat 0x00A8 1") }, + [0x0304] = { 0x00AF, false, nps("flat 0x00AF 1") }, + [0x0301] = { 0x00B4, false, nps("flat 0x00B4 1") }, + [0x0302] = { 0x02C6, true, nps("flat 0x02C6 1") }, + [0x030C] = { 0x02C7, true, nps("flat 0x02C7 1") }, + [0x0306] = { 0x02D8, false, nps("flat 0x02D8 1") }, + [0x0307] = { 0x02D9, false, nps("flat 0x02D9 1") }, + [0x030A] = { 0x02DA, false, nps("flat 0x02DA 1") }, + [0x0303] = { 0x02DC, true, nps("flat 0x02DC 1") }, + [0x20DB] = { 0x20DB, false, nps("flat 0x20DB 1") }, } -local hat = fonts.helpers.newprivateslot("hat 0x0302") -- todo other sizes + datasets.fixaccents = mapping + datasets.extendaccents = mapping + datasets.flattenaccents = mapping + datasets.copyaccents = mapping function mathtweaks.fixaccents(target,original,parameters) local characters = target.characters - -characters[hat] = copytable(characters[0x0302]) -- TODO - + local done = false for stretching, entry in sortedhash(mapping) do local alias = entry[1] local stretchingdata = characters[stretching] @@ -2218,23 +2377,43 @@ characters[hat] = copytable(characters[0x0302]) -- TODO local width = -topanchor topanchor = width/2 stretchingdata.width = width + stretchingdata.advance = 0 stretchingdata.topanchor = topanchor stretchingdata.commands = { rightcommand[width + topanchor], charcommand[stretching] } - if trace_tweaking then - report_tweak("width of initial extensible accent %U set",target,original,stretching) + if not trace_tweaking then + done = true + elseif done then + done[stretching] = true + else + done = { [stretching] = true } end end end + feedback_tweak("fixaccents",target,original,done) end + -- all true|number false + function mathtweaks.extendaccents(target,original,parameters) local characters = target.characters + local all = parameters.all + local count = tonumber(all) + local done = false for stretching, entry in sortedhash(mapping) do local extend = entry[2] - local stretchingdata = characters[stretching] if extend then - local last = stretchingdata + local last = characters[stretching] + local cnt = 1 + local okay = false while last do + if all or (count and cnt > count) then + last.extensible = true + local flataccent = last.flataccent + if flataccent then + characters[flataccent].extensible = true + okay = true + end + end local n = last.next if n then last = characters[n] @@ -2243,16 +2422,72 @@ characters[hat] = copytable(characters[0x0302]) -- TODO local flataccent = last.flataccent if flataccent then characters[flataccent].extensible = true + okay = true end break end + cnt = cnt + 1 + end + if okay then + if not trace_tweaking then + done = true + elseif done then + done[stretching] = true + else + done = { [stretching] = true } + end + end + end + end + feedback_tweak("extendaccents",target,original,done) + end + + -- force true false + -- height factor 0.8 + -- offset factor 0.9|calculated + -- squeeze factor 0.1|calculated + + function mathtweaks.flattenaccents(target,original,parameters) + local characters = target.characters + local force = parameters.force + local squeeze = parameters.squeeze or 0.8 + local ofactor = parameters.offset or (squeeze/2) + local hfactor = parameters.height or (1 - ofactor) + local done = false + for stretching, entry in sortedhash(mapping) do + local last = characters[stretching] + while last do + if force or not last.flataccent then + local slot = entry[3] + local data = copytable(last) + local height = data.height or 0 + data.effect = { squeeze = squeeze } + data.height = hfactor * height + data.yoffset = ofactor * height + characters[slot] = data + last.flataccent = slot + if not trace_tweaking then + done = true + elseif done then + done[stretching] = true + else + done = { [stretching] = true } + end + end + local n = last.next + if n then + last = characters[n] + else + break end end end + feedback_tweak("flattenaccents",target,original,done) end function mathtweaks.copyaccents(target,original,parameters) local characters = target.characters + local done = false for stretching, entry in sortedhash(mapping) do local alias = entry[1] if alias ~= stretching then @@ -2266,15 +2501,20 @@ characters[hat] = copytable(characters[0x0302]) -- TODO next = stretchingdata.next, commands = { charcommand[stretching] }, topanchor = stretchingdata.topanchor, - -- unicode = stretching, -- when we aliasize to combiners + -- unicode = stretching, -- when we alias to combiners unicode = alias, -- when we keep the original } - if trace_tweaking then - report_tweak("extensibles accent %U copied to %U",target,original,stretching,alias) + if not trace_tweaking then + done = true + elseif done then + done[stretching] = true + else + done = { [stretching] = true } end end end end + feedback_tweak("copyaccents",target,original,done) end end @@ -2335,8 +2575,8 @@ do local parameters = target.parameters local linewidth = target.MathConstants.RadicalRuleThickness -- make option local basechar = characters[radical] - local baseheight = basechar.height/2 - local basedepth = basechar.depth/2 + local baseheight = (basechar.height or 0)/2 + local basedepth = (basechar.depth or 0)/2 local basetotal = baseheight + basedepth local used = baseheight -- @@ -2364,7 +2604,7 @@ do downcommand[basedepth], { "rule", basetotal, linewidth }, }, - vparts = { + parts = { { advance = basetotal, ["end"] = used, @@ -2408,7 +2648,7 @@ do upcommand[baseheight-4*linewidth], { "rule", 4*linewidth, linewidth }, }, - vparts = { + parts = { { advance = basetotal, ["end"] = used, @@ -2489,7 +2729,7 @@ do commands = { scale == 1 and charcommand[basecode] or { "slot", 0, basecode, scale, scale }, }, - vparts = { + parts = { { advance = used, ["end"] = used, @@ -2553,13 +2793,13 @@ do -- local used = 0.8*height local used = 1.2*height -- large overlap because no smaller pieces local total = height + depth - characters[single].vparts = extensible(single,total,used) + characters[single].parts = extensible(single,total,used) characters[double] = { unicode = double, width = 2*width - 1*advance, height = height, depth = depth, - vparts = extensible(double,total,used), + parts = extensible(double,total,used), callback = "devirtualize", commands = { charcommand[single], @@ -2787,16 +3027,10 @@ do elseif trace_tweaking then report_tweak("skipping mirror %U (%s)",target,original,unicode,what) end - local hparts = data.hparts - if hparts then - for i=1,#hparts do - add(target,original,characters,hparts[i],"hpart") - end - end - local vparts = data.vparts - if vparts then - for i=1,#vparts do - add(target,original,characters,vparts[i],"vpart") + local parts = data.parts + if parts then + for i=1,#parts do + add(target,original,characters,parts[i],"hpart") end end local smaller = data.smaller @@ -2907,7 +3141,7 @@ do if setlist or resetlist then local properties = target.properties local codes = tex.mathcontrolcodes - local oldcontrol = tex.get("mathfontcontrol") + local oldcontrol = texget("mathfontcontrol") local newcontrol = oldcontrol -- todo: reset if resetlist then @@ -2989,15 +3223,13 @@ do local features = target.specification.features.normal local definedfont = fonts.definers.internal local copiedglyph = fonts.handlers.vf.math.copy_glyph --- does a deep copy, including parts and so + -- does a deep copy, including parts and so local getsubstitution = fonts.handlers.otf.getsubstitution local fontdata = fonts.hashes.identifiers -- local fonts = target.fonts local size = target.size local characters = target.characters --- local descriptions = target.descriptions - -- compact: size = 655360 if not fonts then fonts = { } target.fonts = fonts @@ -3019,8 +3251,7 @@ do local firstsource = sourcerange.first local lastsource = sourcerange.last or firstsource if firstsource and firsttarget then - local offset = firsttarget - firstsource - local topovershoot = entry.topovershoot + local offset = firsttarget - firstsource if filename then local rscale = entry.rscale or 1 -- todo size = size * rscale -- maybe use scale in vf command @@ -3047,11 +3278,10 @@ do if feature then sourceunicode = getsubstitution(dropin,sourceunicode,feature,true,"math","dflt") or sourceunicode end - if trace_tweaking then - report_tweak("copying %s %U from file %a to %s %U",target,original,thesource,sourceunicode,filename,thetarget,targetunicode) - end +-- if trace_tweaking then +-- report_tweak("copying %s %U from file %a to %s %U",target,original,thesource,sourceunicode,filename,thetarget,targetunicode) +-- end characters[targetunicode] = copiedglyph(target,characters,chars,sourceunicode,index) --- description end end elseif feature then @@ -3062,11 +3292,10 @@ do local variant = getsubstitution(original,sourceunicode,feature,true,"math","dflt") local data = characters[variant] if data then - if trace_tweaking then - report_tweak("copying %s %U from feature %a to %s %U",target,original,thesource,sourceunicode,feature,thetarget,targetunicode) - end +-- if trace_tweaking then +-- report_tweak("copying %s %U from feature %a to %s %U",target,original,thesource,sourceunicode,feature,thetarget,targetunicode) +-- end characters[targetunicode] = copytable(data) --- description end end else @@ -3075,13 +3304,12 @@ do local sourceunicode = mathgaps[s] or s local targetunicode = mathgaps[t] or t if sourceunicode ~= targetunicode then - local data = characters[sourceunicode] + local data = characters[sourceunicode] if data then - if trace_tweaking then - report_tweak("copying %s %U to %s %U",target,original,thesource,sourceunicode,thetarget,targetunicode) - end +-- if trace_tweaking then +-- report_tweak("copying %s %U to %s %U",target,original,thesource,sourceunicode,thetarget,targetunicode) +-- end characters[targetunicode] = copytable(data) --- description end end end @@ -3184,21 +3412,23 @@ local function applytweaks(when,target,original) end end +local function tweakable(target) + local mathparameters = target.mathparameters +-- local features = target.specification.features +-- local mathscript = features and features.normal and features.normal.script == "math" +-- return mathparameters and mathscript -- and target,properties.hasmath + return mathparameters +end + function mathematics.tweakbeforecopyingfont(target,original) - if use_math_goodies then - local mathparameters = target.mathparameters -- why not hasmath - if mathparameters then - applytweaks("beforecopying",target,original) - end + if use_math_goodies and tweakable(target) then + applytweaks("beforecopying",target,original) end end function mathematics.tweakaftercopyingfont(target,original) - if use_math_goodies then - local mathparameters = target.mathparameters -- why not hasmath - if mathparameters then - applytweaks("aftercopying",target,original) - end + if use_math_goodies and tweakable(target) then + applytweaks("aftercopying",target,original) end end @@ -3232,8 +3462,7 @@ do local reported = table.setmetatableindex("table") function mathematics.checkaftercopyingfont(target,original) - local mathparameters = target.mathparameters -- why not hasmath - if mathparameters then + if tweakable(target) then local chardata = characters.data local characters = target.characters -- @@ -3300,11 +3529,8 @@ do end function mathematics.beforepassingfonttotex(target) - if use_math_goodies then - local mathparameters = target.mathparameters -- why not hasmath - if mathparameters then - applytweaks("beforepassing",target,target) - end + if tweakable(target) then + applytweaks("beforepassing",target,target) end end @@ -3352,15 +3578,7 @@ local function extensiblecode(font,unicode) if not char then return unknown end - if character.hparts then - if character.vparts then - return { e_mixed, code, character } - else - local m = char.mathextensible - local e = m and extensibles[m] - return e and { e, code, character } or unknown - end - elseif character.vparts then + if character.parts then local m = char.mathextensible local e = m and extensibles[m] return e and { e, code, character } or unknown @@ -3402,19 +3620,19 @@ local function horizontalcode(family,unicode) local loffset = 0 local roffset = 0 if kind == e_left then - local charlist = data[3].hparts + local charlist = data[3].parts if charlist then local left = charlist[1] loffset = abs((left["start"] or 0) - (left["end"] or 0)) end elseif kind == e_right then - local charlist = data[3].hparts + local charlist = data[3].parts if charlist then local right = charlist[#charlist] roffset = abs((right["start"] or 0) - (right["end"] or 0)) end elseif kind == e_horizontal then - local charlist = data[3].hparts + local charlist = data[3].parts if charlist then local left = charlist[1] local right = charlist[#charlist] @@ -3444,3 +3662,52 @@ interfaces.implement { -- can be public with two times "integerargument" context(kind) end } + +function mathematics.variantcode(unicode,variant) + local data = fontcharacters[getfontoffamily(texget("fam"))] + local char = data and data[unicode] + if char then + for i=1,variant do + local next = char.next + if next then + unicode = next + char = data[next] + else + break + end + end + end + return unicode +end + +function mathematics.variantcount(unicode) + local data = fontcharacters[getfontoffamily(texget("fam"))] + local char = data and data[unicode] + local count = 0 + if char then + while true do + local next = char.next + if next then + count = count + 1 + char = data[next] + else + break + end + end + end + return count +end + +interfaces.implement { + name = "mathvariantcode", + public = true, + arguments = { "integer", "integer" }, + actions = { mathematics.variantcode, context }, +} + +interfaces.implement { + name = "mathvariantcount", + public = true, + arguments = "integer", + actions = { mathematics.variantcount, context }, +} diff --git a/tex/context/base/mkxl/math-ali.mkxl b/tex/context/base/mkxl/math-ali.mkxl index af6b48cee..8a29f4f9d 100644 --- a/tex/context/base/mkxl/math-ali.mkxl +++ b/tex/context/base/mkxl/math-ali.mkxl @@ -2871,11 +2871,11 @@ %D Usage \type {\sum _ {\mstack {i \in V_{0}, i \neq j}}}, documented by Mikael: -\permanent\protected\def\mstack#1% +\permanent\protected\def\mstack#1% todo: make it configurable {\begingroup \scratchtoks\emptytoks \setcharstrut(\relax - \processcommalist[#1]{\iftok\scratchtoks\emptytoks\else\toksapp\scratchtoks{\strut\NR}\fi\toksapp\scratchtoks}% - \expandafter\startsubstack\the\scratchtoks\strut\stopsubstack + \processcommalist[#1]{\iftok\scratchtoks\emptytoks\else\toksapp\scratchtoks{\mathstrut\NR}\fi\toksapp\scratchtoks}% + \expandafter\startsubstack\the\scratchtoks\mathstrut\stopsubstack \endgroup} %D Similar to simplecases: diff --git a/tex/context/base/mkxl/math-fen.mkxl b/tex/context/base/mkxl/math-fen.mkxl index b3c85070f..d8cbf4e76 100644 --- a/tex/context/base/mkxl/math-fen.mkxl +++ b/tex/context/base/mkxl/math-fen.mkxl @@ -54,6 +54,8 @@ \c!height=\zeropoint, \c!depth=\zeropoint, \c!distance=\zerocount, + \c!topspace=\zeropoint, + \c!bottomspace=\zeropoint, \c!factor=\v!auto] \appendtoks @@ -83,6 +85,17 @@ %D $ a + \fenced[bar] {\frac {b} {c}} + d $ %D \stoptyping +% \startbuffer +% $ \left( \frac{1}{x}^{2} \right)$ +% $ \left( x \right)$ +% $ \left( x^2 \right)$ +% $ \left( \frac{1}{x} \right)$ +% $ \left( \frac{1}{x}^2 \right)$ +% \stopbuffer +% +% \getbuffer\blank +% {\setupmathfence[topspace=-2pt,bottomspace=-1pt]\getbuffer\blank} + % todo : class -> number \newconditional\c_math_fenced_mirror \settrue \c_math_fenced_mirror @@ -205,6 +218,10 @@ \fi \s!source \numexpr\namedboxanchor{\mathfenceparameter#4}\relax + % + \s!top \mathfenceparameter\c!topspace + \s!bottom \mathfenceparameter\c!bottomspace + % \math_fenced_trace \ifx\p_fence\v!none \Udelimiter\mathghostcode\fam\zerocount diff --git a/tex/context/base/mkxl/math-ini.mkxl b/tex/context/base/mkxl/math-ini.mkxl index c1beb071c..259fd360e 100644 --- a/tex/context/base/mkxl/math-ini.mkxl +++ b/tex/context/base/mkxl/math-ini.mkxl @@ -111,6 +111,8 @@ +\analyzescriptnucleusboxmathcontrolcode +\accenttopskewwithoffsetmathcontrolcode % +\ignorekerndimensionsmathcontrolcode % xits needs this (bad depth of fences) + % +\ignoreflataccentsmathcontrolcode + +\extendaccentsmathcontrolcode \relax % \mathpenaltiesmode\plusone @@ -891,7 +893,6 @@ % Now we redefine \type {\mathematics} and \type {\m}: \pushoverloadmode - \permanent\protected\def\mathematics{\doifelsenextoptionalcs\math_m_yes\math_m_nop} \aliased\let\m \mathematics % we keep the simple versions @@ -3723,6 +3724,54 @@ \definemathtext[mathsplitbi][mathsplit][\c!style=\bi] \definemathtext[mathsplitbs][mathsplit][\c!style=\bs] +% \startbuffer +% $ +% { x\! \neq x!} \quad {\ss x\! \neq x!} \qquad +% {\it x\! \neq x!} \quad {\ss \it x\! \neq x!} \qquad +% {\fi x\! \neq x!} \quad {\ss \fi x\! \neq x!} \qquad +% {\bi x\! \neq x!} \quad {\ss \bi x\! \neq x!} +% $ +% \stopbuffer +% +% \startTEXpage[offset=1dk] +% \getbuffer \par \automathtext \getbuffer +% \stopTEXpage + +\newconditional\c_mathtextauto % we need aproper key: \settrue\c_mathtextauto + +\permanent\protected\def\automathtext{\settrue\c_mathtextauto} + +\let\currentmathalphabet \s!rm +\let\currentmathfontstyle\s!tf + +\permanent\protected\def\mathtextauto#1#2% + {\ifconditional\c_mathtextauto + \mathortext + {\mathpunct + {\begincsname\currentmathalphabet\endcsname + \begincsname mathtext\currentmathfontstyle\endcsname + {#1}}}% + {#1}% + \else + #2% + \fi} + +%D Actually in spac-hor.mkxl we defined them using \suggestedalias which redefines +%D these so basically we now make that sort of obsolete. +%D +%D \starttyping +%D $x\, x$\quad\automathtext$x\, x$ +%D \stoptyping + +\pushoverloadmode + \permanent\protected\def\.{\mathtextauto{.}{.}} + \permanent\protected\def\,{\mathtextauto{,}{\thinspace }} + \permanent\protected\def\:{\mathtextauto{:}{\medspace }} + \permanent\protected\def\;{\mathtextauto{;}{\thickspace}} + \permanent\protected\def\!{\mathtextauto{!}{\negthinspace}} + \permanent\protected\def\?{\mathtextauto{?}{?}} +\popoverloadmode + \appendtoks \reinstatecatcodecommand\barasciicode \obeydiscretionaries @@ -4294,13 +4343,21 @@ %D Just to be sure: -\immutable\integerdef\c_math_glyph_options\numexpr +\immutable\integerdef\c_math_glyph_options_default\numexpr \noexpansionglyphoptioncode +\noprotrusionglyphoptioncode \relax +\immutable\integerdef\c_math_glyph_options_hz\numexpr + \noprotrusionglyphoptioncode +\relax + \appendtoks - \glyphoptions\c_math_glyph_options + \ifcstok{\mathematicsparameter\v!hz}\v!yes + \glyphoptions\c_math_glyph_options_hz + \else + \glyphoptions\c_math_glyph_options_default + \fi \to \everymathematics %D Bonus for testing: diff --git a/tex/context/base/mkxl/math-lop.mkxl b/tex/context/base/mkxl/math-lop.mkxl index 8be8fc98d..327d663e8 100644 --- a/tex/context/base/mkxl/math-lop.mkxl +++ b/tex/context/base/mkxl/math-lop.mkxl @@ -67,7 +67,9 @@ \ifchkdim\mathoperatorparameter\c!size\or \s!depth \mathoperatorparameter\c!size \s!height\mathoperatorparameter\c!size - \s!axis + \s!axis % variants + \s!noaxis % extensibles (assumes also axis) + \s!exact % make sure we don't overshoot when there are no variants and extensibles \orelse\ifcstok{\mathoperatorparameter\c!size}\v!auto \s!auto \fi @@ -118,9 +120,10 @@ \setupmathematics[\c!integral=nolimits] -\definemathoperator [integral] [integrals] [\c!left="222B] % these might go unless we decide -\definemathoperator [iintegral] [integrals] [\c!left="222C] % to have verbose parents but who -\definemathoperator [iiintegral] [integrals] [\c!left="222D] % will use them +\definemathoperator [integral] [integrals] [\c!left="222B] % these might go unless we decide +\definemathoperator [iintegral] [integrals] [\c!left="222C] % to have verbose parents but who +\definemathoperator [iiintegral] [integrals] [\c!left="222D] % will use them +\definemathoperator [iiiintegral] [integrals] [\c!left="2A0C] \definemathoperator [int] [integrals] [\c!left="222B] % INTEGRAL \definemathoperator [iint] [integrals] [\c!left="222C] % DOUBLE INTEGRAL diff --git a/tex/context/base/mkxl/math-map.lmt b/tex/context/base/mkxl/math-map.lmt index d0a1410a1..98cc59c89 100644 --- a/tex/context/base/mkxl/math-map.lmt +++ b/tex/context/base/mkxl/math-map.lmt @@ -46,6 +46,8 @@ local setmetatableindex = table.setmetatableindex local texgetattribute = tex.getattribute local texsetattribute = tex.setattribute +local setmacro = tokens.setters.macro + local texgetmode = tex.getmode local mathmode_code = tex.modelevels.math @@ -711,9 +713,19 @@ implement { protected = true, actions = function(alphabet,style) if texgetmode() == mathmode_code then - local data = alphabets[alphabet] or regular - data = data[style] or data.tf - texsetattribute(mathalphabet,data and data.attribute or texattribute[mathalphabet]) + local data = alphabets[alphabet] + if not data then + alphabet = "regular" + data = regular + end + local used = data[style] + if not used then + style = "tf" + used = data.tf + end + setmacro("currentmathalphabet",alphabet == "regular" and "rm" or alphabet) + setmacro("currentmathfontstyle",style) + texsetattribute(mathalphabet,used and used.attribute or texattribute[mathalphabet]) end end } @@ -728,6 +740,7 @@ implement { local r = mathremap[texgetattribute(mathalphabet)] local alphabet = r and r.alphabet or "regular" local data = alphabets[alphabet][style] + setmacro("currentmathfontstyle",style) texsetattribute(mathalphabet,data and data.attribute or texattribute[mathalphabet]) end end diff --git a/tex/context/base/mkxl/math-vfu.lmt b/tex/context/base/mkxl/math-vfu.lmt index 86d1fca0d..c1d45551b 100644 --- a/tex/context/base/mkxl/math-vfu.lmt +++ b/tex/context/base/mkxl/math-vfu.lmt @@ -85,7 +85,7 @@ local shared = { } local function brace(main,characters,id,size,unicode,first,rule,left,right,rule,last) if not characters[unicode] then characters[unicode] = { - hparts = { + parts = { { extender = 0, glyph = first }, { extender = 1, glyph = rule }, { extender = 0, glyph = left }, @@ -123,7 +123,7 @@ local function extension(main,characters,id,size,unicode,first,middle,last) if lw == 0 then lw = 1 end - chr.hparts = { + chr.parts = { { extender = 0, glyph = first, ["end"] = fw/2, start = 0, advance = fw }, { extender = 1, glyph = middle, ["end"] = mw/2, start = mw/2, advance = mw }, { extender = 0, glyph = last, ["end"] = 0, start = lw/2, advance = lw }, @@ -133,7 +133,7 @@ end local function parent(main,characters,id,size,unicode,first,rule,last) if not characters[unicode] then characters[unicode] = { - hparts = { + parts = { { extender = 0, glyph = first }, { extender = 1, glyph = rule }, { extender = 0, glyph = last }, @@ -668,13 +668,13 @@ local function copy_glyph(main,target,original,unicode,slot) break -- safeguard (when testing stuff) end end - local hv = olddata.hparts - if hv then - hv = fastcopy(hv) - newdata.hparts = hv - for i=1,#hv do - local hvi = hv[i] - local oldglyph = hvi.glyph + local pv = olddata.parts + if pv then + pv = fastcopy(pv) + newdata.parts = pv + for i=1,#hp do + local pvi = pv[i] + local oldglyph = pvi.glyph local olddata = original[oldglyph] local newdata = { width = olddata.width, @@ -683,25 +683,7 @@ local function copy_glyph(main,target,original,unicode,slot) tounicode = olddata.tounicode, commands = { { "slot", slot, oldglyph } }, } - hvi.glyph = addprivate(main,formatters["M-H-%H"](oldglyph),newdata) - end - end - local vv = olddata.vparts - if vv then - vv = fastcopy(vv) - newdata.vparts = vv - for i=1,#vv do - local vvi = vv[i] - local oldglyph = vvi.glyph - local olddata = original[oldglyph] - local newdata = { - width = olddata.width, - height = olddata.height, - depth = olddata.depth, - tounicode = olddata.tounicode, - commands = { { "slot", slot, oldglyph } }, - } - vvi.glyph = addprivate(main,formatters["M-V-%H"](oldglyph),newdata) + pvi.glyph = addprivate(main,formatters["M-P-%H"](oldglyph),newdata) end end local smaller = olddata.smaller @@ -1029,30 +1011,18 @@ function vfmath.define(specification,set,goodies) if n then t.next = offset + n elseif variants_done then - local vv = fci.vparts - if vv then - t.vparts = vv - end - local hv = fci.hparts - if hv then - t.hparts = hv + local v = fci.parts + if v then + t.parts = v end else - local vv = fci.vparts - if vv then - for i=1,#vv do - local vvi = vv[i] - vvi.glyph = vvi.glyph + offset - end - t.vparts = vv - end - local hv = fci.hparts - if hv then - for i=1,#hv do - local hvi = hv[i] - hvi.glyph = hvi.glyph + offset + local v = fci.parts + if v then + for i=1,#v do + local vi = v[i] + vi.glyph = vi.glyph + offset end - t.hparts = hv + t.parts = v end end characters[offset + index] = t diff --git a/tex/context/base/mkxl/meta-imp-glyphs.mkxl b/tex/context/base/mkxl/meta-imp-glyphs.mkxl new file mode 100644 index 000000000..96f7aecd3 --- /dev/null +++ b/tex/context/base/mkxl/meta-imp-glyphs.mkxl @@ -0,0 +1,65 @@ +%D \module +%D [ file=meta-imp-glyphs, +%D version=2022.10.26, % moved from test files by MS and HH +%D title=\METAPOST\ Graphics, +%D subtitle=Glyph Shape Manipulations, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startMPdefinitions + + def LoadGlyph(expr tag, filename, unicode) = + glyphshape_start(filename,unicode) ; + expandafter picture scantokens(tag & "char"); + expandafter path scantokens(tag & "bbox") ; + expandafter numeric scantokens(tag & "accent") ; + expandafter numeric scantokens(tag & "italic") ; + scantokens(tag & "char") := image (draw for i=1 upto glyphshape_n : glyphshape_path(i) && endfor cycle ;) ; + scantokens(tag & "bbox") := glyphshape_usedbox ; + scantokens(tag & "accent") := glyphshape_accent ; + scantokens(tag & "italic") := xpart urcorner glyphshape_usedbox - glyphshape_italic ; + glyphshape_stop ; + enddef ; + + def ScaleGlyph(expr tag, s) = + scantokens(tag & "char") := scantokens(tag & "char") scaled s ; + scantokens(tag & "bbox") := scantokens(tag & "bbox") scaled s ; + scantokens(tag & "accent") := s * scantokens(tag & "accent") ; + scantokens(tag & "italic") := s * scantokens(tag & "italic") ; + enddef ; + + def ShiftGlyph(expr tag, dx, dy) = + scantokens(tag & "char") := scantokens(tag & "char") shifted (dx, dy) ; + scantokens(tag & "bbox") := scantokens(tag & "bbox") shifted (dx, dy) ; + scantokens(tag & "accent") := scantokens(tag & "accent") + dx ; + scantokens(tag & "italic") := scantokens(tag & "italic") + dx ; + enddef ; + + def DrawGlyph(expr tag) = + draw scantokens(tag & "char") withpen pencircle scaled 1 ; + draw scantokens(tag & "bbox") withcolor "darkyellow" ; + draw (scantokens(tag & "accent"), (ypart urcorner scantokens(tag & "bbox"))) withcolor "darkmagenta" withpen pencircle scaled 5 ; + draw (scantokens(tag & "italic"), .5(ypart urcorner scantokens(tag & "bbox"))) withcolor "orange" withpen pencircle scaled 5 ; + enddef ; + +\stopMPdefinitions + +\startMPdefinitions + + def ShowShape(expr font, slot) = + glyphshape_start(font, slot) ; + draw for i=1 upto glyphshape_n : glyphshape_path(i) && endfor cycle ; + draw glyphshape_boundingbox withcolor red ; + draw glyphshape_usedline withcolor green ; + draw glyphshape_usedbox withcolor blue ; + draw (glyphshape_accent,glyphshape_depth) withcolor "orange" withpen pencircle scaled 5 ; + draw (glyphshape_italic,glyphshape_depth) withcolor "orange" withpen pencircle scaled 5 ; + glyphshape_stop ; + enddef; + +\stopMPdefinitions diff --git a/tex/context/base/mkxl/mlib-ctx.mkxl b/tex/context/base/mkxl/mlib-ctx.mkxl index 384650a45..7c88585e9 100644 --- a/tex/context/base/mkxl/mlib-ctx.mkxl +++ b/tex/context/base/mkxl/mlib-ctx.mkxl @@ -29,6 +29,7 @@ \registerctxluafile{mlib-pos}{autosuffix} \registerctxluafile{mlib-cnt}{autosuffix} \registerctxluafile{mlib-svg}{autosuffix} +\registerctxluafile{mlib-fnt}{autosuffix} % outline fun \unprotect diff --git a/tex/context/base/mkxl/font-mps.lmt b/tex/context/base/mkxl/mlib-fnt.lmt index 7afc48d0f..e53ded38a 100644 --- a/tex/context/base/mkxl/font-mps.lmt +++ b/tex/context/base/mkxl/mlib-fnt.lmt @@ -6,9 +6,10 @@ if not modules then modules = { } end modules ['font-mps'] = { license = "see context related readme files" } -local tostring = tostring -local concat = table.concat -local formatters = string.formatters +local type, tonumber, tostring = type, tonumber, tostring +local concat, insert, remove = table.concat, table.insert, table.remove +local formatters, match = string.formatters, string.match +local utfbyte = utf.byte -- QP0 [QP1] QP2 => CP0 [CP1 CP2] CP3 @@ -33,8 +34,8 @@ local f_dofill = formatters["fill %s;"] local f_draw_trace = formatters["drawpathonly %s;"] local f_draw = formatters["draw %s;"] -local f_boundingbox = formatters["((%N,%N)--(%N,%N)--(%N,%N)--(%N,%N)--cycle)"] -local f_vertical = formatters["((%N,%N)--(%N,%N))"] +local f_rectangle = formatters["((%N,%N)--(%N,%N)--(%N,%N)--(%N,%N)--cycle)"] +local f_line = formatters["((%N,%N)--(%N,%N))"] function metapost.boundingbox(d,factor) local bounds = d.boundingbox @@ -43,7 +44,7 @@ function metapost.boundingbox(d,factor) local lly = factor*bounds[2] local urx = factor*bounds[3] local ury = factor*bounds[4] - return f_boundingbox(llx,lly,urx,lly,urx,ury,llx,ury) + return f_rectangle(llx,lly,urx,lly,urx,ury,llx,ury) end function metapost.baseline(d,factor) @@ -51,7 +52,7 @@ function metapost.baseline(d,factor) local factor = factor or 1 local llx = factor*bounds[1] local urx = factor*bounds[3] - return f_vertical(llx,0,urx,0) + return f_line(llx,0,urx,0) end function metapost.widthline(d,factor) @@ -60,7 +61,7 @@ function metapost.widthline(d,factor) local lly = factor*bounds[2] local ury = factor*bounds[4] local width = factor*d.width - return f_vertical(width,lly,width,ury) + return f_line(width,lly,width,ury) end function metapost.zeroline(d,factor) @@ -68,7 +69,7 @@ function metapost.zeroline(d,factor) local factor = factor or 1 local lly = factor*bounds[2] local ury = factor*bounds[4] - return f_vertical(0,lly,0,ury) + return f_line(0,lly,0,ury) end function metapost.paths(d,xfactor,yfactor) @@ -247,7 +248,7 @@ function metapost.maxbounds(data,index,factor) if width > urx then urx = width end - return f_boundingbox( + return f_rectangle( factor*llx,factor*ymin, factor*urx,factor*ymin, factor*urx,factor*ymax, @@ -274,11 +275,15 @@ local emptyrule_code = rulecodes.empty local nuts = nodes.nuts local getwhd = nuts.getwhd local getexpansion = nuts.getexpansion +local getscales = nuts.getscales local isglyph = nuts.isglyph -local characters = fonts.hashes.characters -local parameters = fonts.hashes.parameters -local shapes = fonts.hashes.shapes +local fonthashes = fonts.hashes +local fontcharacters = fonthashes.characters +local fontparameters = fonthashes.parameters +local fontshapes = fonthashes.shapes +local fontdescriptions = fonthashes.descriptions + local topaths = metapost.paths local f_text = formatters["mfun_do_outline_text_flush(%q,%i,%N,%N,%q)(%,t);"] @@ -289,18 +294,18 @@ local s_nothing = "(origin scaled 10)" local sc = 10 local fc = number.dimenfactors.bp -local function glyph(kind,font,char,advance,shift,ex) - local character = characters[font][char] +local function glyph(kind,font,char,advance,shift,ex,s, sx,sy) + local character = fontcharacters[font][char] if character then local index = character.index if index then - local shapedata = shapes[font] - local glyphs = shapedata.glyphs -- todo: subfonts fonts.shapes.indexed(font,sub) + local shapedata = fontshapes[font] + local glyphs = shapedata.glyphs if glyphs then local glyf = glyphs[index] if glyf then local units = 1000 -- factor already takes shapedata.units into account - local yfactor = (sc/units) * parameters[font].factor / 655.36 + local yfactor = (sc/units) * fontparameters[font].factor / 655.36 local xfactor = yfactor local shift = shift or 0 local advance = advance or 0 @@ -311,6 +316,10 @@ local function glyph(kind,font,char,advance,shift,ex) wfactor = (1+(ex/units)/1000) xfactor = xfactor * wfactor end + if s then + xfactor = (s/1000) * ((sx or 1000)/1000) * xfactor + yfactor = (s/1000) * ((sy or 1000)/1000) * yfactor + end local paths = topaths(glyf,xfactor,yfactor) if paths then return f_text(kind,#paths,advance,shift,detail,paths) -- , character.width * fc * wfactor @@ -334,7 +343,8 @@ end local function flushcharacter(current, pos_h, pos_v, pod_r, font, char) local char, font = isglyph(current) - local code = glyph(kind,font,char,pos_h*fc,pos_v*fc,getexpansion(current)) + local s, sx, sy = getscales(current) + local code = glyph(kind,font,char,pos_h*fc,pos_v*fc,getexpansion(current),s,sx,sy) if code then b = b + 1 buffer[b] = code @@ -405,3 +415,134 @@ function metapost.boxtomp(n,k) return result end +-- This is a new set of commands: + +local loaded = table.setmetatableindex(function(t,k) + local v = fonts.definers.internal({ name = k } ,"<lmt:glyphshape:font>") + t[k] = v + return v +end) + +local mpdata = 0 +local mpstack = { } + +function mp.lmt_glyphshape_start(id,character) + if type(id) == "string" then + id = loaded[id] + end + local fontid = (id and id ~= 0 and id) or font.current() + local shapedata = fontshapes [fontid] -- by index + local characters = fontcharacters [fontid] -- by unicode + local descriptions = fontdescriptions[fontid] -- by unicode + local mathgaps = mathematics.gaps -- not yet loaded + local shapeglyphs = shapedata.glyphs or { } + if type(character) == "string" and character ~= "" then + local hex = match(character,"^0x(.+)") + if hex then + character = tonumber(hex,16) + else + character = utfbyte(character) + end + else + character = tonumber(character) + end + local unicode = mathgaps[character] or character + local chardata = characters[unicode] + local descdata = descriptions[unicode] + if chardata then + glyph = shapeglyphs[chardata.index] + if glyph then + mpdata = glyph.mpdata + if not mpdata then + if glyph.segments or glyph.sequence then + local units = shapedata.units or 1000 + local factor = 100/units + local width = (descdata.width or 0) * factor + local height = descdata.boundingbox[4] * factor + local depth = descdata.boundingbox[2] * factor + local math = descdata.math + local italic = (math and math.italic or 0) * factor + local accent = (math and math.accent or 0) * factor + mpdata = { + paths = metapost.paths(glyph,factor), + boundingbox = metapost.boundingbox(glyph,factor), + baseline = metapost.baseline(glyph,factor), + width = width, + height = height, + depth = depth, + italic = italic, + accent = accent, + usedbox = f_rectangle(0,depth,width,depth,width,height,0,height), + usedline = f_line(0,0,width,0), + } + glyph.mpdata = mpdata + else + print("CHECK 1",id,character) + end + end + end + else + print("CHECK 2",id,character) + end + insert(mpstack, mpdata) +end + +local mpprint = mp.print +local injectpair = mp.inject.pair +local injectnumeric = mp.inject.numeric + +function mp.lmt_glyphshape_stop() + mpdata = remove(mpstack) +end + +function mp.lmt_glyphshape_n() + if mpdata then + mpprint(#mpdata.paths) + else + injectnumeric(0) + end +end + +function mp.lmt_glyphshape_path(i) + if mpdata then + mpprint(mpdata.paths[i]) + else + injectpair(0,0) + end +end + +function mp.lmt_glyphshape_boundingbox() + if mpdata then + mpprint(mpdata.boundingbox) + else + injectpair(0,0) + end +end +function mp.lmt_glyphshape_usedbox() + if mpdata then + mpprint(mpdata.usedbox) + else + injectpair(0,0) + end +end + +function mp.lmt_glyphshape_baseline() + if mpdata then + mpprint(mpdata.baseline) + else + injectpair(0,0) + end +end +function mp.lmt_glyphshape_usedline() + if mpdata then + mpprint(mpdata.usedline) + else + injectpair(0,0) + end +end + +function mp.lmt_glyphshape_width () injectnumeric(mpdata and mpdata.width or 0) end +function mp.lmt_glyphshape_depth () injectnumeric(mpdata and mpdata.depth or 0) end +function mp.lmt_glyphshape_height() injectnumeric(mpdata and mpdata.height or 0) end +function mp.lmt_glyphshape_italic() injectnumeric(mpdata and mpdata.italic or 0) end +function mp.lmt_glyphshape_accent() injectnumeric(mpdata and mpdata.accent or 0) end diff --git a/tex/context/base/mkxl/mult-sys.mkxl b/tex/context/base/mkxl/mult-sys.mkxl index 636c15363..f04418e43 100644 --- a/tex/context/base/mkxl/mult-sys.mkxl +++ b/tex/context/base/mkxl/mult-sys.mkxl @@ -45,6 +45,9 @@ \definesystemconstant {afrikaans} \definesystemconstant {af} \definesystemconstant {albanian} \definesystemconstant {sq} +\definesystemconstant {armenian} \definesystemconstant {hy} + \definesystemconstant {hye} + \definesystemconstant {hyw} \definesystemconstant {ancientgreek} \definesystemconstant {agr} \definesystemconstant {ancientlatin} \definesystemconstant {ala} \definesystemconstant {arabic} \definesystemconstant {ar} diff --git a/tex/context/base/mkxl/node-cmp.lmt b/tex/context/base/mkxl/node-cmp.lmt index 8f805abd9..887020351 100644 --- a/tex/context/base/mkxl/node-cmp.lmt +++ b/tex/context/base/mkxl/node-cmp.lmt @@ -202,12 +202,8 @@ local iszeroglue = direct.iszeroglue local getglue = direct.getglue local setglue = direct.setglue -function node.iszeroglue(n) return iszeroglue(todirect(n)) end -function node.getglue (n) return getglue (todirect(n)) end -function node.setglue (n) return setglue (todirect(n)) end - -node.family_font = tex.getfontoffamily - --- node.get_glue = node.getglue --- node.set_glue = node.setglue +function node.iszeroglue(n) return iszeroglue(todirect(n)) end +function node.getglue (n) return getglue (todirect(n)) end +function node.setglue (n,...) return setglue (todirect(n),...) end +node.family_font = tex.getfontoffamily diff --git a/tex/context/base/mkxl/node-res.lmt b/tex/context/base/mkxl/node-res.lmt index e023499e5..daf0187e8 100644 --- a/tex/context/base/mkxl/node-res.lmt +++ b/tex/context/base/mkxl/node-res.lmt @@ -8,6 +8,7 @@ if not modules then modules = { } end modules ['node-res'] = { local type, next, rawset = type, next, rawset local gmatch, format = string.gmatch, string.format +local round = math.round --[[ldx-- <p>The next function is not that much needed but in <l n='context'/> we use @@ -381,7 +382,7 @@ function nutpool.outlinerule(width,height,depth,line) -- w/h/d == nil will let t setwhd(n,width,height,depth) end if line then - setruledata(n,line) + setruledata(n,round(line)) -- has to be an integer end return n end diff --git a/tex/context/base/mkxl/spac-chr.lmt b/tex/context/base/mkxl/spac-chr.lmt index 554dc0400..a71c4a0e1 100644 --- a/tex/context/base/mkxl/spac-chr.lmt +++ b/tex/context/base/mkxl/spac-chr.lmt @@ -28,6 +28,9 @@ local nodes, node = nodes, node local nuts = nodes.nuts +local getid = nuts.getid +local getsubtype = nuts.getsubtype +local setsubtype = nuts.setsubtype local getboth = nuts.getboth local getnext = nuts.getnext local getprev = nuts.getprev @@ -37,7 +40,6 @@ local getlanguage = nuts.getlanguage local setchar = nuts.setchar local setattrlist = nuts.setattrlist local getfont = nuts.getfont -local setsubtype = nuts.setsubtype local isglyph = nuts.isglyph local setcolor = nodes.tracers.colors.set @@ -60,10 +62,12 @@ local nodecodes = nodes.nodecodes local gluecodes = nodes.gluecodes local glyph_code = nodecodes.glyph +local glue_code = nodecodes.glue local spaceskip_code = gluecodes.spaceskip local chardata = characters.data -local is_punctuation = characters.is_punctuation +local ispunctuation = characters.is_punctuation +local canhavespace = characters.can_have_space local typesetters = typesetters @@ -182,16 +186,28 @@ local methods = { -- maybe also 0x0008 : backspace + [0x001E] = function(head,current) -- kind of special + local next = getnext(current) + head, current = remove_node(head,current,true) + if next and getid(next) == glue_code and getsubtype(next) == spaceskip_code then + local nextnext = getnext(next) + if nextnext then + local char, font = isglyph(nextnext) + if char and not canhavespace[char] then + remove_node(head,next,true) + end + end + end + end, + [0x001F] = function(head,current) -- kind of special local next = getnext(current) if next then local char, font = isglyph(next) - if char then - head, current = remove_node(head,current,true) - if not is_punctuation[char] then - local p = fontparameters[font] - head, current = insertnodebefore(head,current,new_glue(p.space,p.spacestretch,p.spaceshrink)) - end + head, current = remove_node(head,current,true) + if char and not ispunctuation[char] then + local p = fontparameters[font] + head, current = insertnodebefore(head,current,new_glue(p.space,p.spacestretch,p.spaceshrink)) end end end, diff --git a/tex/context/base/mkxl/spac-chr.mkxl b/tex/context/base/mkxl/spac-chr.mkxl index 82c8be0ec..a7d339019 100644 --- a/tex/context/base/mkxl/spac-chr.mkxl +++ b/tex/context/base/mkxl/spac-chr.mkxl @@ -66,7 +66,8 @@ \popoverloadmode -\immutable\chardef\optionalspace"1F % will be space unless before punctuation +\immutable\chardef\optionalspace "1F % will be space unless before punctuation +\immutable\chardef\autoinsertedspace"1E % a more clever \autoinsertspace % Shortcuts: diff --git a/tex/context/base/mkxl/spac-hor.lmt b/tex/context/base/mkxl/spac-hor.lmt index d32684448..a4a8f0ade 100644 --- a/tex/context/base/mkxl/spac-hor.lmt +++ b/tex/context/base/mkxl/spac-hor.lmt @@ -10,24 +10,14 @@ local chardata = characters.data local peekchar = tokens.scanners.peekchar local ctx_space = context.space -local can_have_space = table.tohash { - "lu", "ll", "lt", "lm", "lo", -- letters - -- "mn", "mc", "me", -- marks - "nd", "nl", "no", -- numbers - "ps", "pi", -- initial - -- "pe", "pf", -- final - -- "pc", "pd", "po", -- punctuation - "sm", "sc", "sk", "so", -- symbols - -- "zs", "zl", "zp", -- separators - -- "cc", "cf", "cs", "co", "cn", -- others -} +local can_have_space = characters.can_have_space interfaces.implement { name = "autoinsertnextspace", protected = true, public = true, actions = function() - local char = peekchar() + local char = peekchar() -- nil means space command if char then local d = chardata[char] if d and can_have_space[d.category] then diff --git a/tex/context/base/mkxl/spac-hor.mkxl b/tex/context/base/mkxl/spac-hor.mkxl index c4c806a40..4c153931b 100644 --- a/tex/context/base/mkxl/spac-hor.mkxl +++ b/tex/context/base/mkxl/spac-hor.mkxl @@ -1073,6 +1073,8 @@ \definehspace[2] [.2222\emwidth] % med \definehspace[3] [.2777\emwidth] % thick +% These will be redefined anyway in math-ini: + \suggestedalias \, \thinspace \suggestedalias \: \medspace \suggestedalias \; \thickspace diff --git a/tex/context/base/mkxl/strc-mat.mkxl b/tex/context/base/mkxl/strc-mat.mkxl index 71676c9ec..90321a627 100644 --- a/tex/context/base/mkxl/strc-mat.mkxl +++ b/tex/context/base/mkxl/strc-mat.mkxl @@ -2010,6 +2010,20 @@ \fi \to \everysetupformula +%D Also new, handy for articles and manuals: + +% \starttext +% \showmakeup[line] +% \input tufte \startformula e = mc^2 \stopformula +% \input tufte \startformula[bodyfont=10pt] e = mc^2 \stopformula +% \input tufte \startformula[bodyfont=24pt] e = mc^2 \stopformula +% \input tufte +% \stoptext + +\prependtoks + \usebodyfontparameter\formulaparameter +\to \everymathematics + \protect \endinput % \abovedisplayshortskip0pt \belowdisplayshortskip0pt \abovedisplayskip0pt \belowdisplayskip0pt \forgetall diff --git a/tex/context/base/mkxl/tabl-tbl.mkxl b/tex/context/base/mkxl/tabl-tbl.mkxl index 851984bea..91ee0262a 100644 --- a/tex/context/base/mkxl/tabl-tbl.mkxl +++ b/tex/context/base/mkxl/tabl-tbl.mkxl @@ -3060,6 +3060,9 @@ %D \stoptabulate %D \stoptyping +% Not okay yet as we loose alignment in later columns .. weird .. do +% we miss a tab? + \installcorenamespace{tabulatespanb} \installcorenamespace{tabulatespana} @@ -3076,7 +3079,9 @@ \noaligned\tolerant\def\tabl_tabulate_NS[#1]#*[#2]% {\NC\loopcs{#1}\tabl_tabulate_span - \gdef\tabl_tabulate_kooh{\begincsname\??tabulatespana#2\endcsname}% + \gdef\tabl_tabulate_kooh + {\begincsname\??tabulatespana#2\endcsname + \glet\tabl_tabulate_kooh\relax}% \begincsname\??tabulatespanb#2\endcsname \ignorepars} % \ignorespaces diff --git a/tex/context/base/mkxl/trac-vis.lmt b/tex/context/base/mkxl/trac-vis.lmt index e2c79022a..09c0e020c 100644 --- a/tex/context/base/mkxl/trac-vis.lmt +++ b/tex/context/base/mkxl/trac-vis.lmt @@ -41,6 +41,7 @@ local setattr = nuts.setattr local setwidth = nuts.setwidth local setshift = nuts.setshift local setoffsets = nuts.setoffsets +local getglyphdimensions = nuts.getglyphdimensions local getid = nuts.getid local getfont = nuts.getfont @@ -922,22 +923,27 @@ local ruledglyph do -- local ligature_code = 0x8000 + nodes.glyphcodes.ligature ruledglyph = function(head,current,previous) -- wrong for vertical glyphs - local wd = getwidth(current) + local wd, ht, dp = getglyphdimensions(current) if wd ~= 0 then - local wd, ht, dp = getwhd(current) local next = getnext(current) local prev = previous setboth(current) local linewidth = emwidth/(2*fraction) local x_offset, y_offset, l_margin, r_margin, raise = getoffsets(current) - local info = setlink((dp == 0 and outlinerule and outlinerule(wd,ht,dp,linewidth)) or userrule { - width = wd, - height = ht, - depth = dp, - line = linewidth, - type = "box", - },new_kern(-wd)) - -- if getsubtype(n) == ligature_code then +-- local info = setlink((dp == 0 and outlinerule and outlinerule(wd,ht,dp,linewidth)) or userrule { +-- width = wd, +-- height = ht, +-- depth = dp, +-- line = linewidth, +-- type = "box", +-- },new_kern(-wd)) +local info = (dp == 0 and outlinerule and outlinerule(wd,ht,dp,linewidth)) or userrule { + width = wd, + height = ht, + depth = dp, + line = linewidth, + type = "box", +} local c, f = isglyph(current) local char = chardata[f][c] if char and type(char.unicode) == "table" then -- hackery test diff --git a/tex/context/base/mkxl/type-imp-euler.mkxl b/tex/context/base/mkxl/type-imp-euler.mkxl index c0a3f73f6..a2e066f6b 100644 --- a/tex/context/base/mkxl/type-imp-euler.mkxl +++ b/tex/context/base/mkxl/type-imp-euler.mkxl @@ -11,6 +11,10 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% Instead of euler.otf we now use euler-math.otf which is a copy of the version +% that Daniel Flipo maintains now. We will also make an euler-regular.otf for +% text usage (which might have slighty different metrics then). + \loadtypescriptfile[texgyre] \loadtypescriptfile[dejavu] @@ -21,11 +25,11 @@ \starttypescript [\s!serif] [eulernova] [\s!name] \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym [\s!Serif] [\s!file:euler.otf] [\s!features=\s!default] + \definefontsynonym [\s!Serif] [\s!file:euler-math.otf] [\s!features=\s!default] \stoptypescript \starttypescript [\s!math] [eulernova] [\s!name] - \definefontsynonym [\s!MathRoman] [\s!file:euler.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=euler-math] + \definefontsynonym [\s!MathRoman] [\s!file:euler-math.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=euler-math] \stoptypescript \starttypescript [pagella-eulernova] @@ -47,7 +51,7 @@ \stoptypescript \starttypescript [\s!math] [pagellaovereuler] [\s!name] - \definefontsynonym [\s!MathRoman] [\s!file:euler.otf] [\s!features={\s!math\mathsizesuffix,pagellaovereuler,mathextra},\s!fallbacks=pagellaovereuler,\s!goodies=euler-math] + \definefontsynonym [\s!MathRoman] [\s!file:euler-math.otf] [\s!features={\s!math\mathsizesuffix,pagellaovereuler,mathextra},\s!fallbacks=pagellaovereuler,\s!goodies=euler-math] \stoptypescript \starttypescript [pagella-with-euler,euleroverpagella] diff --git a/tex/context/base/mkxl/type-set.mkxl b/tex/context/base/mkxl/type-set.mkxl index ae07bd914..7eec5cc60 100644 --- a/tex/context/base/mkxl/type-set.mkxl +++ b/tex/context/base/mkxl/type-set.mkxl @@ -31,7 +31,7 @@ \loadfoundtypescriptfile\empty{type-lua.mkxl} \loadfoundtypescriptfile\empty{type-siz.mkxl} \loadfoundtypescriptfile\empty{type-fbk.mkxl} - \loadfoundtypescriptfile\empty{type-imp-latinmodern.mkiv} + \loadfoundtypescriptfile\empty{type-imp-latinmodern.mkiv} % maybe no longer % and not: @@ -54,19 +54,19 @@ \usetypescriptfile[fbk] \usetypescriptfile[lua] \usetypescriptfile[siz] - \usetypescriptfile[latinmodern] + \usetypescriptfile[latinmodern] % maybe no longer \usetypescriptfile[loc] \fi +\definefilesynonym [type-imp-modern.mkiv] [type-imp-latinmodern.mkiv] \definefilesynonym [type-imp-latin-modern.mkiv] [type-imp-latinmodern.mkiv] \definefilesynonym [type-imp-modern-latin.mkiv] [type-imp-modernlatin.mkiv] \definefilesynonym [type-imp-less-modern-latin.mkiv] [type-imp-modernlatin.mkiv] -%definefilesynonym [type-imp-lucida.mkiv] [type-imp-lucida-typeone.mkiv] -\definefilesynonym [type-imp-lucida.mkiv] [type-imp-lucida-opentype.mkiv] -\definefilesynonym [type-imp-lucidaot.mkiv] [type-imp-lucida-opentype.mkiv] -\definefilesynonym [type-imp-lucidadk.mkiv] [type-imp-lucida-opentype.mkiv] +\definefilesynonym [type-imp-lucida-opentype.mkiv] [type-imp-lucida.mkiv] +\definefilesynonym [type-imp-lucidaot.mkiv] [type-imp-lucida.mkiv] +\definefilesynonym [type-imp-lucidadk.mkiv] [type-imp-lucida.mkiv] \definefilesynonym [type-imp-dejavu-condensed.mkiv] [type-imp-dejavu.mkiv] @@ -148,4 +148,24 @@ \definefilesynonym [type-imp-gentiumplus.mkiv] [type-imp-gentium.mkiv] \definefilesynonym [type-imp-gentiumbook.mkiv] [type-imp-gentium.mkiv] +%D These \type {*-nt} variants come in handy when we want top compare with non-tweaked math. + +\definefilesynonym [type-imp-bonum-nt.mkiv] [type-imp-texgyre.mkiv] +\definefilesynonym [type-imp-schola-nt.mkiv] [type-imp-texgyre.mkiv] +\definefilesynonym [type-imp-pagella-nt.mkiv] [type-imp-texgyre.mkiv] +\definefilesynonym [type-imp-termes-nt.mkiv] [type-imp-texgyre.mkiv] +\definefilesynonym [type-imp-dejavu-nt.mkiv] [type-imp-dejavu.mkiv] +\definefilesynonym [type-imp-cambria-nt.mkiv] [type-imp-cambria.mkiv] +\definefilesynonym [type-imp-lucidaot-nt.mkiv] [type-imp-lucida-opentype.mkiv] +\definefilesynonym [type-imp-lucida-nt.mkiv] [type-imp-lucida-opentype.mkiv] +\definefilesynonym [type-imp-modern-nt.mkiv] [type-imp-latinmodern.mkiv] +\definefilesynonym [type-imp-stix-nt.mkiv] [type-imp-stix.mkiv] +\definefilesynonym [type-imp-stixtwo-nt.mkiv] [type-imp-stix.mkiv] +\definefilesynonym [type-imp-libertinus-nt.mkiv] [type-imp-libertinus.mkiv] +\definefilesynonym [type-imp-ebgaramond-nt.mkiv] [type-imp-ebgaramond.mkiv] +\definefilesynonym [type-imp-erewhon-nt.mkiv] [type-imp-erewhon.mkiv] +\definefilesynonym [type-imp-kpfonts-nt.mkiv] [type-imp-kpfonts.mkiv] +\definefilesynonym [type-imp-concrete-nt.mkiv] [type-imp-concrete.mkiv] +\definefilesynonym [type-imp-xcharter-nt.mkiv] [type-imp-xcharter.mkiv] + \protect \endinput diff --git a/tex/context/base/mkxl/typo-chr.lmt b/tex/context/base/mkxl/typo-chr.lmt index 745a35a14..160981ab7 100644 --- a/tex/context/base/mkxl/typo-chr.lmt +++ b/tex/context/base/mkxl/typo-chr.lmt @@ -31,7 +31,7 @@ local flushnode = nodes.flushnode local flushlist = nodes.flushlist local settexattribute = tex.setattribute -local punctuation = characters.is_punctuation +local ispunctuation = characters.is_punctuation local variables = interfaces.variables local v_all = variables.all @@ -51,7 +51,7 @@ local function pickup() local list = texgetnest() if list then local tail = list.tail - if tail and tail.id == glyph_code and punctuation[tail.char] then + if tail and tail.id == glyph_code and ispunctuation[tail.char] then local prev = tail.prev list.tail = prev if prev then diff --git a/tex/context/base/mkxl/typo-itc.lmt b/tex/context/base/mkxl/typo-itc.lmt index f0b6980f4..c26d4a824 100644 --- a/tex/context/base/mkxl/typo-itc.lmt +++ b/tex/context/base/mkxl/typo-itc.lmt @@ -72,7 +72,7 @@ local italicsdata = fonthashes.italics local exheights = fonthashes.exheights local chardata = fonthashes.characters -local is_punctuation = characters.is_punctuation +local ispunctuation = characters.is_punctuation local implement = interfaces.implement @@ -217,7 +217,7 @@ local function domath(head,current) if glyph and getid(glyph) == glyph_code then -- [math: <glyph><kern>]<glyph> : we remove the correction when we have -- punctuation - if is_punctuation[char] then + if ispunctuation[char] then local a = getattr(glyph,a_mathitalics) if a then local i = getkern(kern) @@ -257,7 +257,7 @@ local function domath(head,current) -- if glyph and getid(glyph) == glyph_code then -- -- [math: <glyph>]<glyph> : we add the correction when we have -- -- no punctuation - -- if not is_punctuation[char] then + -- if not ispunctuation[char] then -- local a = getattr(glyph,a_mathitalics) -- if a and (a < 100 or a > 100) then -- if a > 100 then diff --git a/tex/context/fonts/mkiv/asana-math.lfg b/tex/context/fonts/mkiv/asana-math.lfg deleted file mode 100644 index 970d031ea..000000000 --- a/tex/context/fonts/mkiv/asana-math.lfg +++ /dev/null @@ -1,107 +0,0 @@ -local common = fonts.goodies.load("common-math.lfg") -local presets = common.mathematics.tweaks.presets - -return { - name = "asana-math", - version = "1.00", - comment = "Goodies that complement asana.", - author = "Hans Hagen & Mikael Sundqvist", - copyright = "ConTeXt development team", - mathematics = { - parameters = { - -- StackBottomDisplayStyleShiftDown = less, - -- StackBottomShiftDown = less, - -- StackDisplayStyleGapMin = less, - -- StackGapMin = less, - -- StackTopDisplayStyleShiftUp = less, - -- StackTopShiftUp = less, - -- StretchStackBottomShiftDown = less, - -- StretchStackGapAboveMin = less, - -- StretchStackGapBelowMin = less, - -- StretchStackTopShiftUp = less, - NoLimitSupFactor = 200, - NoLimitSubFactor = 1200, - AccentBaseDepth = 300, - RadicalDegreeBottomRaisePercent = 70, - RadicalRuleThickness = 66, -- 59 in font - DelimiterPercent = 90, - DelimiterShortfall = 400, - DisplayOperatorMinHeight = 1800, -- 1250 in font - }, - tweaks = { - aftercopying = { - { - tweak = "version", - expected = "Version 000.958", - message = "this font is not supported", - }, - { - tweak = "addmirrors", - }, - presets.scripttocalligraphic { }, - presets.rsfstoscript { }, - presets.rsfsuprighttoscript { }, - presets.moderntocalligraphic { }, - presets.eulertocalligraphic { }, - presets.xitsarabic { }, - presets.fallbacks { }, - presets.moveitalics { correct = true }, - presets.moveitalics { correct = true, letters = true }, - presets.moveintegrals { factor = 2 }, - presets.wipeitalics { }, - { - tweak = "dimensions", - list = { - -- nothing yet - } - }, - -- { - -- tweak = "kerns", - -- list = { - -- [0x2F] = { - -- topleft = -0.2, - -- bottomleft = 0, - -- topright = 0, - -- bottomright = -0.2, - -- }, - -- }, - -- }, - -- { - -- tweak = "fixprimes", - -- factor = 0.85, - -- scale = 0.65, - -- smaller = true, - -- }, - { - tweak = "checkspacing", - }, - { - tweak = "addscripts", - }, - { - tweak = "accentdimensions", - }, - { - tweak = "addrules", - }, - { - tweak = "fixellipses", - }, - { - tweak = "setoptions", - set = { "ignorekerndimensions" } - }, - -- this is the mkiv section - { - tweak = "emulatelmtx", - feature = "emulatelmtx", - comment = "this is for mkiv", - }, - }, - }, - bigslots = { - 1, 2, 3, 4 - }, - } -} - diff --git a/tex/context/fonts/mkiv/bonum-math.lfg b/tex/context/fonts/mkiv/bonum-math.lfg index e5d764aff..cc7ae23dc 100644 --- a/tex/context/fonts/mkiv/bonum-math.lfg +++ b/tex/context/fonts/mkiv/bonum-math.lfg @@ -2,8 +2,8 @@ local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets local integral_variants = { bottomright = -0.20 } -local integral_top = { topright = 0.05 } -local integral_bottom = { bottomright = -0.30 } +local integral_top = { topright = 0 } +local integral_bottom = { bottomright = -0.10 } -- if too big it looks bad with triple integrals return { name = "bonum-math", @@ -13,14 +13,14 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, AccentTopShiftUp = -15, FlattenedAccentTopShiftUp = -15, -- AccentExtendMargin = 50, AccentBaseDepth = 50, - RadicalDegreeBottomRaisePercent = 60, - RadicalRuleThickness = 66, -- 72 in font + -- RadicalDegreeBottomRaisePercent = 60, +-- RadicalRuleThickness = 66, -- 72 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1900, -- 1250 in font @@ -131,15 +131,19 @@ return { [0x27EB] = { topright = -0.1, bottomright = -0.1 }, ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- - [0x222B] = integral_variants, ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, - [0x222C] = integral_variants, ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, - [0x222D] = integral_variants, ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, - [0x222E] = integral_variants, ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, - [0x222F] = integral_variants, ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, - [0x2230] = integral_variants, ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, - [0x2231] = integral_variants, ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, - [0x2232] = integral_variants, ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, - [0x2233] = integral_variants, ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, + -- [0x222B] = integral_variants, ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, + ["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int + ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint + ["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint + ["0x2A0C.parts.bottom"] = { bottomright = -0.05 }, -- iiiint + -- [0x222C] = integral_variants, ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, + -- [0x222D] = integral_variants, ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, + -- [0x222E] = integral_variants, ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, + -- [0x222F] = integral_variants, ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, + -- [0x2230] = integral_variants, ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, + -- [0x2231] = integral_variants, ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, + -- [0x2232] = integral_variants, ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, + -- [0x2233] = integral_variants, ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, }, }, -- Accents are a mess. We migrate the extensibles from the combiners to the base accent @@ -148,6 +152,30 @@ return { { tweak = "extendaccents", }, +{ + tweak = "flattenaccents", + squeeze = 0.8, + height = 0.9, + offset = 0.1, +}, + +{ + tweak = "radicaldegreeanchors", + list = { + [0x221A] = { location = "left", hfactor = .1, vfactor = .3 }, + ["0x221A.variants.*"] = { location = "left", hfactor = .1, vfactor = .625 }, + ["0x221A.variants.1"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = .1, vfactor = 1.15 }, + } +}, + { tweak = "fixaccents", }, diff --git a/tex/context/fonts/mkiv/cambria-math.lfg b/tex/context/fonts/mkiv/cambria-math.lfg index 9cece8369..8feb94bcf 100644 --- a/tex/context/fonts/mkiv/cambria-math.lfg +++ b/tex/context/fonts/mkiv/cambria-math.lfg @@ -9,15 +9,15 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 1000, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 1000, -- AccentTopShiftUp = 0, -- FlattenedAccentTopShiftUp = 0, -- AccentExtendMargin = 50, AccentBaseDepth = 300, - RadicalDegreeBottomRaisePercent = 65, - RadicalKernAfterDegree = -900, - RadicalRuleThickness = 128, -- 133 in font + -- RadicalDegreeBottomRaisePercent = 65, + -- RadicalKernAfterDegree = -900, + -- RadicalRuleThickness = 128, -- 133 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 2800, -- 2500 in font @@ -76,6 +76,7 @@ return { }, -- Keep as example. not needed in cambria (after all it is the reference): + [0x2A0C] = { bottomright = -0.1 }, -- iiiint does not have any ic -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, -- ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, @@ -95,6 +96,22 @@ return { { tweak = "extendaccents", }, +{ + tweak = "radicaldegreeanchors", + list = { + [0x221A] = { location = "left", hfactor = -0.15, vfactor = .75 }, + ["0x221A.variants.*"] = { location = "left", hfactor = -0.1, vfactor = .15 }, + ["0x221A.variants.1"] = { location = "left", hfactor = -0.1, vfactor = .55 }, + ["0x221A.variants.2"] = { location = "left", hfactor = -0.1, vfactor = .375 }, + ["0x221A.variants.3"] = { location = "left", hfactor = -0.1, vfactor = .275 }, + ["0x221A.variants.4"] = { location = "left", hfactor = -0.1, vfactor = .22 }, + ["0x221A.variants.5"] = { location = "left", hfactor = -0.1, vfactor = .175 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = -0.1, vfactor = 0.95 }, + } +}, { tweak = "fixaccents", }, @@ -183,6 +200,9 @@ return { tweak = "addactuarian", }, { + tweak = "addequals", + }, + { tweak = "addfourier", variant = 1, }, diff --git a/tex/context/fonts/mkiv/common-math.lfg b/tex/context/fonts/mkiv/common-math.lfg index c2c690bf1..85915c26a 100644 --- a/tex/context/fonts/mkiv/common-math.lfg +++ b/tex/context/fonts/mkiv/common-math.lfg @@ -56,13 +56,13 @@ return { { source = "uppercasescript", target = "uppercasecalligraphic", - filename = "euler.otf", + filename = "euler-math.otf", rscale = parameters.rscale, }, { source = "uppercaseboldscript", target = "uppercaseboldcalligraphic", - filename = "euler.otf", + filename = "euler-math.otf", rscale = parameters.rscale, }, }, diff --git a/tex/context/fonts/mkiv/concrete-math.lfg b/tex/context/fonts/mkiv/concrete-math.lfg index 68d686593..31ee4f1b9 100644 --- a/tex/context/fonts/mkiv/concrete-math.lfg +++ b/tex/context/fonts/mkiv/concrete-math.lfg @@ -9,8 +9,8 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, DelimiterPercent = 90, DelimiterShortfall = 400, -- DisplayOperatorMinHeight = 1800, -- 1400 in font (one size) @@ -19,12 +19,15 @@ return { aftercopying = { { tweak = "fixprimes", - factor = 0.9, + factor = 0.8, }, -- there are circular variants -- { -- tweak = "addmirrors", -- }, +{ + tweak = "fixintegrals", +}, presets.scripttocalligraphic { }, presets.rsfstoscript { }, presets.rsfsuprighttoscript { }, @@ -41,6 +44,23 @@ return { [0x002F] = { topleft = -0.2, bottomright = -0.2 }, }, }, + +{ + tweak = "radicaldegreeanchors", + list = { + -- [0x221A] = { location = "left", hfactor = .1, vfactor = .3 }, + -- ["0x221A.variants.*"] = { location = "left", hfactor = .1, vfactor = .625 }, + -- ["0x221A.variants.1"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = .0, vfactor = 1.075 }, + } +}, { tweak = "fixellipses", }, diff --git a/tex/context/fonts/mkiv/dejavu-math.lfg b/tex/context/fonts/mkiv/dejavu-math.lfg index 70eecb27e..728a5f2fc 100644 --- a/tex/context/fonts/mkiv/dejavu-math.lfg +++ b/tex/context/fonts/mkiv/dejavu-math.lfg @@ -1,8 +1,8 @@ local common = fonts.goodies.load("common-math.lfg") local presets = common.mathematics.tweaks.presets -local integral_variants = { bottomright = -0.20 } -local integral_bottom = { bottomright = -0.25 } +local integral_variants = { bottomright = -0.20 } +local integral_bottom = { bottomright = -0.25 } return { name = "dejavu-math", @@ -12,15 +12,15 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, FractionRuleThickness = 60, AccentTopShiftUp = -25, FlattenedAccentTopShiftUp = -25, -- AccentExtendMargin = 50, AccentBaseDepth = 30, - RadicalDegreeBottomRaisePercent = 62, - RadicalRuleThickness = 46, -- 52 in font + -- RadicalDegreeBottomRaisePercent = 62, + -- RadicalRuleThickness = 46, -- 52 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1800, -- 1333 in font @@ -33,11 +33,17 @@ return { tweak = "version", expected = "Version 1.106", }, - { +-- { +-- tweak = "fixprimes", +-- scale = 0.85, +-- -- smaller = true, +-- factor = 1, +-- }, + { tweak = "fixprimes", - scale = 0.85, + scale = 1, -- smaller = true, - factor = 1, + factor = 0.8, }, { tweak = "addmirrors", @@ -53,6 +59,18 @@ return { presets.moveitalics { correct = true, letters = true }, presets.moveintegrals { factor = 1.5 }, -- we need to check this presets.wipeitalics { }, + -- We don't have italic correction in for instance math italic f which means that + -- we also didn't fix it. Therefore we need at least some reasonable kerns. Using + -- a dimension tweak before the above (e.g. 0.2 italic and 0.8 width) doesn't work + -- because once the advance is set the move is blocked and the ic stil wiped. So, + -- we kern. Actually the upright (ascii) f has italic correction. + { + tweak = "kerns", + list = { + [0x1D453] = { bottomright = -.2 }, + } + }, + -- { tweak = "kerns", list = { @@ -71,15 +89,20 @@ return { [0x27EB] = { topright = -0.1, bottomright = -0.1 }, ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- - ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, - ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, - ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, - ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, - ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, - ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, - ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, - ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, - ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, + + ["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int + ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint + ["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint + ["0x2A0C.parts.bottom"] = { bottomright = -0.05 }, -- iiiint + -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, + -- ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, + -- ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, + -- ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, + -- ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, + -- ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, + -- ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, + -- ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, + -- ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, }, }, @@ -89,6 +112,24 @@ return { { tweak = "extendaccents", }, + + +{ + tweak = "radicaldegreeanchors", + list = { + [0x221A] = { location = "left", hfactor = .1, vfactor = .65 }, + ["0x221A.variants.*"] = { location = "left", hfactor = .1, vfactor = .6 }, + ["0x221A.variants.1"] = { location = "left", hfactor = .1, vfactor = .65 }, + ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .65 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = .1, vfactor = 1.1 }, + } +}, { tweak = "fixaccents", }, @@ -128,12 +169,6 @@ return { tweak = "copyaccents", }, { - tweak = "fixprimes", - -- scale = 0.9, - -- smaller = true, - factor = 0.8, - }, - { tweak = "checkspacing", }, { @@ -176,11 +211,11 @@ return { bigslots = { 1, 3, 5, 7 }, - -- - -- experimental fixes for mkiv: - -- - dimensions = dimensions, - kerns = kerns, + -- -- + -- -- experimental fixes for mkiv: + -- -- + -- dimensions = dimensions, + -- kerns = kerns, }, } diff --git a/tex/context/fonts/mkiv/garamond-math.lfg b/tex/context/fonts/mkiv/ebgaramond-math.lfg index 9537f52b9..555b79bc1 100644 --- a/tex/context/fonts/mkiv/garamond-math.lfg +++ b/tex/context/fonts/mkiv/ebgaramond-math.lfg @@ -9,8 +9,8 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 1200, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 1200, FractionRuleThickness = 60, OverbarRuleThickness = 60, UnderbarRuleThickness = 60, @@ -147,10 +147,28 @@ return { -- accent anchor offset). First we copy and fix. { tweak = "extendaccents", + -- all = true, +-- all = 5, }, - { - tweak = "fixanchors", - }, +{ + tweak = "radicaldegreeanchors", + list = { + -- [0x221A] = { location = "left", hfactor = .1, vfactor = .3 }, + -- ["0x221A.variants.*"] = { location = "left", hfactor = .1, vfactor = .625 }, + -- ["0x221A.variants.1"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = .0, vfactor = 1.0 }, + } +}, + -- { + -- tweak = "fixanchors", + -- }, -- First we set the dimensions of the initial accent which started out as zero but we want -- a proper width. { @@ -235,7 +253,7 @@ return { outbendingh = { feature = 'ss10', value = 1, comment = "Out-bending h" }, largeoperators = { feature = 'ss11', value = 1, comment = "Larger operators" }, }, - bigs = { + bigslots = { 1, 3, 5, 7 }, }, diff --git a/tex/context/fonts/mkiv/erewhon-math.lfg b/tex/context/fonts/mkiv/erewhon-math.lfg index e366ee12e..89b788b3f 100644 --- a/tex/context/fonts/mkiv/erewhon-math.lfg +++ b/tex/context/fonts/mkiv/erewhon-math.lfg @@ -12,13 +12,13 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, - AccentBaseHeight = 0, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, + -- AccentBaseHeight = 0, AccentBaseDepth = 60, - RadicalDegreeBottomRaisePercent = 55, - RadicalKernAfterDegree = -600, - RadicalRuleThickness = 45, -- 55 in font + -- RadicalDegreeBottomRaisePercent = 55, + -- RadicalKernAfterDegree = -600, + -- RadicalRuleThickness = 45, -- 55 in font DelimiterPercent = 90, DelimiterShortfall = 400, -- DisplayOperatorMinHeight = 1800, -- 1300 in font (one size) @@ -27,12 +27,23 @@ return { aftercopying = { { tweak = "fixprimes", + -- smaller = true, -- replace multiples factor = 0.9, - scale = 0.9, + scale = 1.0, + fake = 0.85, -- replace multiples with this width proportion }, { tweak = "addmirrors", }, +{ + tweak = "dimensions", + list = { + ["0x222B.variants.*"] = { axis = .15 }, + }, +}, +{ + tweak = "fixintegrals", +}, presets.scripttocalligraphic { }, presets.rsfstoscript { }, presets.rsfsuprighttoscript { }, @@ -63,6 +74,23 @@ return { ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, }, }, +{ + tweak = "radicaldegreeanchors", + list = { + -- [0x221A] = { location = "left", hfactor = .1, vfactor = .3 }, + -- ["0x221A.variants.*"] = { location = "left", hfactor = .1, vfactor = .625 }, + -- ["0x221A.variants.1"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = .1, vfactor = 1.025 }, + } +}, + { tweak = "checkspacing", }, @@ -83,7 +111,7 @@ return { }, { tweak = "setoptions", - set = { "ignorekerndimensions" } +-- set = { "ignorekerndimensions" } }, -- this is the mkiv section -- { diff --git a/tex/context/fonts/mkiv/kpfonts-math.lfg b/tex/context/fonts/mkiv/kpfonts-math.lfg index a4eff599f..8f2153077 100644 --- a/tex/context/fonts/mkiv/kpfonts-math.lfg +++ b/tex/context/fonts/mkiv/kpfonts-math.lfg @@ -12,11 +12,11 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, -- AccentBaseHeight = 0, AccentBaseDepth = 30, - RadicalDegreeBottomRaisePercent = 70, + -- RadicalDegreeBottomRaisePercent = 70, -- RadicalRuleThickness = 50, -- 50 in font DelimiterPercent = 90, DelimiterShortfall = 400, @@ -52,14 +52,14 @@ return { }, }, - -- { - -- tweak = "fixprimes", - -- factor = 0.85, -- accent base height - -- smaller = true, -- replace multiples - -- scale = 0.75, -- glyph scale - -- fake = 0.75, -- replace multiples with this width proportion - -- -- keep = true, -- keep the text size prime (aka minute) - -- }, + { + tweak = "fixprimes", + factor = 1.4, -- accent base height + smaller = true, -- replace multiples + scale = 1, -- glyph scale + fake = 0.8, -- replace multiples with this width proportion + -- keep = true, -- keep the text size prime (aka minute) + }, { tweak = "addmirrors", }, @@ -99,6 +99,24 @@ return { { tweak = "checkspacing", }, + +{ + tweak = "radicaldegreeanchors", + list = { + [0x221A] = { location = "left", hfactor = .0, vfactor = .75 }, + ["0x221A.variants.*"] = { location = "left", hfactor = .0, vfactor = .55 }, + ["0x221A.variants.1"] = { location = "left", hfactor = .0, vfactor = .6 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = .0, vfactor = 0.65 }, + } +}, + { tweak = "addscripts", }, diff --git a/tex/context/fonts/mkiv/libertinus-math.lfg b/tex/context/fonts/mkiv/libertinus-math.lfg index 5a1cbd088..71863fb59 100644 --- a/tex/context/fonts/mkiv/libertinus-math.lfg +++ b/tex/context/fonts/mkiv/libertinus-math.lfg @@ -17,8 +17,8 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 1000, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 1000, FractionRuleThickness = 50, OverbarRuleThickness = 50, -- RadicalRuleThickness = 50, @@ -28,8 +28,8 @@ return { -- AccentExtendMargin = 50, -- AccentTopShiftUp = 0, AccentBaseDepth = 10, - RadicalDegreeBottomRaisePercent = 60, - RadicalKernAfterDegree = -425, + -- RadicalDegreeBottomRaisePercent = 60, + -- RadicalKernAfterDegree = -425, -- RadicalRuleThickness = 40, -- 40 in font DelimiterPercent = 90, DelimiterShortfall = 400, @@ -47,6 +47,16 @@ return { { tweak = "addmirrors", }, +-- we have a weird middle integral piece +{ + tweak = "dimensions", + list = { + [0x23AE] = { xoffset = -.19 }, + }, +}, +{ + tweak = "fixintegrals", +}, presets.scripttocalligraphic { }, presets.rsfstoscript { rscale = 0.97 }, presets.rsfsuprighttoscript { rscale = 0.97 }, @@ -126,11 +136,31 @@ return { tweak = "copyaccents", }, -- So far for the accents. +{ + tweak = "radicaldegreeanchors", + list = { + [0x221A] = { location = "left", hfactor = .0, vfactor = .625 }, + ["0x221A.variants.*"] = { location = "left", hfactor = .0, vfactor = .5 }, + ["0x221A.variants.1"] = { location = "left", hfactor = .0, vfactor = .55 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = .0, vfactor = 1.15 }, + } +}, + + + { tweak = "fixprimes", scale = 0.9, -- smaller = true, factor = 0.9, + fake = 0.8, }, { tweak = "checkspacing", @@ -159,6 +189,7 @@ return { variant = 1, }, { + -- needed for integrals (bad axis) and (less prominent) fences tweak = "setoptions", set = { "ignorekerndimensions" } }, diff --git a/tex/context/fonts/mkiv/lm.lfg b/tex/context/fonts/mkiv/lm.lfg index 984038d58..13023214a 100644 --- a/tex/context/fonts/mkiv/lm.lfg +++ b/tex/context/fonts/mkiv/lm.lfg @@ -1,8 +1,5 @@ -- In order to be able to use beta math fonts, we use our own file name and --- always remap. - -local common = fonts.goodies.load("common-math.lfg") -local presets = common.mathematics.tweaks.presets +-- always remap (as there is no development we no longer do this). return { name = "latin modern", @@ -10,419 +7,16 @@ return { comment = "Goodies that complement latin modern.", author = "Hans Hagen & Mikael Sundqvist", copyright = "ConTeXt development team", - mathematics = { - parameters = { - FractionNumeratorDisplayStyleShiftUp = 600, -- used to be a function - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, - AccentTopShiftUp = -60, - FlattenedAccentTopShiftUp = -60, - -- AccentExtendMargin = 50, - -- AccentBaseHeight = 0, - -- AccentBaseDepth = 0, - -- AccentTopOvershoot = 66, - AccentSuperscriptDrop = 100, -- drop the superscripts if accents are present. Amount in percentage of height of accent(?) - AccentSuperscriptPercent = 0, - DelimiterPercent = 90, - DelimiterShortfall = 400, - -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) - PrimeRaisePercent = 60, - PrimeRaiseComposedPercent = 15, - -- SubSuperscriptGapMin = 160, -- 160 in font - SuperscriptBaselineDropMax = 250, -- 250 in font - -- SuperscriptBottomMaxWithSubscript = 344, -- 344 in font - -- SuperscriptBottomMin = 108, -- 108 in font - SuperscriptShiftUp = 363, -- 363 in font - SuperscriptShiftUpCramped = 89, -- 289 in font - }, - tweaks = { - aftercopying = { - { - tweak = "version", - expected = "Version 1.958", - }, - { - tweak = "addmirrors", - }, - presets.scripttocalligraphic { }, - presets.rsfstoscript { }, - presets.rsfsuprighttoscript { }, - presets.moderntocalligraphic { }, - presets.eulertocalligraphic { }, - presets.xitsarabic { rscale = 0.80 }, - presets.fallbacks { }, - presets.moveitalics { correct = true }, - presets.moveitalics { correct = true, letters = true }, - presets.moveintegrals { factor = 1.4 }, - presets.wipeanchors { }, - presets.wipeitalics { }, - -- these will become moveanchors - { - tweak = "dimensions", - list = { - -- [0x1D483] = { anchor = 1.15 }, -- bold italic b - -- [0x1D485] = { anchor = 0.8 }, -- bold italic d - [0x1D487] = { anchor = 0.9 }, -- bold italic f - [0x1D489] = { anchor = 1.2 }, -- bold italic h - [0x1D48C] = { anchor = 1.2 }, -- bold italic k - [0x1D48F] = { anchor = 1.1 }, -- bold italic n - [0x1D491] = { anchor = 1.2 }, -- bold italic p - [0x1D492] = { anchor = 0.9 }, -- bold italic q - [0x1D49B] = { anchor = 0.9 }, -- bold italic z - - [0x1D736] = { anchor = 0.9 }, -- bold italic alpha - [0x1D737] = { anchor = 0.9 }, -- bold italic beta - [0x1D738] = { anchor = 1.1 }, -- bold italic gamma - [0x1D740] = { anchor = 1.2 }, -- bold italic lambda - [0x1D744] = { anchor = 1.2 }, -- bold italic omicron - - [0x1D6FE] = { anchor = 1.1 }, -- italic gamma - [0x1D702] = { anchor = 1.1 }, -- italic eta - -- [0x1D70A] = { anchor = 1.2 }, -- italic omicron -- no difference - -- [0x1D70D] = { anchor = 1.2 }, -- italic varsigma -- no difference - - [0x1D44F] = { anchor = 1.15 }, -- italic b - [0x1D451] = { anchor = 0.8, }, -- italic d - [0x1D455] = { anchor = 1.15 }, -- italic h - -- [0x1D456] = { anchor = 1.15 }, -- italic i (wrong code?) - [0x1D458] = { anchor = 1.15 }, -- italic k - [0x1D45B] = { anchor = 1.1 }, -- italic n - [0x1D45D] = { anchor = 1.1 }, -- italic p - [0x1D45E] = { anchor = 0.9 }, -- italic q - [0x1D467] = { anchor = 0.9 }, -- italic z - - [0x1D6FE] = { anchor = 1.2 }, -- italic gamma - [0x1D706] = { anchor = 1.2 }, -- italic lambda - [0x1D70A] = { anchor = 1.1 }, -- italic omikron - [0x1D70D] = { anchor = 1.1 }, -- italic varsigma - - [0x1D46A] = { anchor = 0.75 }, -- bold italic C - [0x1D46B] = { anchor = 1.1 }, -- bold italic D - [0x1D46E] = { anchor = 0.75 }, -- bold italic G - [0x1D479] = { anchor = 1.2 }, -- bold italic R - [0x1D47A] = { anchor = 0.8 }, -- bold italic S - - -- uppercaseboldscript could be improved - - [0x1D435] = { anchor = 1.05 }, -- italic B - [0x1D436] = { anchor = 0.7 }, -- italic C - [0x1D437] = { anchor = 1.05 }, -- italic D - [0x1D43A] = { anchor = 0.8 }, -- italic G - [0x1D443] = { anchor = 1.1 }, -- italic P - [0x1D445] = { anchor = 1.05 }, -- italic R - [0x1D446] = { anchor = 0.85 }, -- italic S - - [0x1D49C] = { anchor = 0.9 }, -- script A - [0x1D49D] = { anchor = 0.95 }, -- script B - [0x1D49E] = { anchor = 0.8 }, -- script C - [0x1D49F] = { anchor = 0.95 }, -- script D - [0x1D4A0] = { anchor = 0.85 }, -- script E - [0x1D4A1] = { anchor = 0.75 }, -- script F - [0x1D4A2] = { anchor = 0.9 }, -- script G - [0x1D4A3] = { anchor = 0.85 }, -- script H - [0x1D4A4] = { anchor = 0.8 }, -- script I - [0x1D4A5] = { anchor = 0.8 }, -- script J - [0x1D4A6] = { anchor = 0.85 }, -- script K - [0x1D4A7] = { anchor = 0.75 }, -- script L - [0x1D4A8] = { anchor = 0.9 }, -- script M - [0x1D4A9] = { anchor = 0.85 }, -- script N - [0x1D4AA] = { anchor = 0.95 }, -- script O - [0x1D4AB] = { anchor = 0.95 }, -- script P - [0x1D4AC] = { anchor = 0.95 }, -- script Q - [0x1D4AD] = { anchor = 0.95 }, -- script R - [0x1D4AE] = { anchor = 0.9 }, -- script S - [0x1D4AF] = { anchor = 0.75 }, -- script T - [0x1D4B0] = { anchor = 0.9, }, -- script U - [0x1D4B1] = { anchor = 0.95 }, -- script V - [0x1D4B2] = { anchor = 0.95 }, -- script W - [0x1D4B3] = { anchor = 0.95 }, -- script X - [0x1D4B4] = { anchor = 0.9 }, -- script Y - [0x1D4B5] = { anchor = 1 }, -- script Z - - -- [984874] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, - -- [984881] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, - -- [984888] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, - -- [984895] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, - -- [984902] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, - -- [984909] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, - -- [984916] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, - - -- ["0x7C.variants.*"] = { squeeze = 0.75, height = 0.75, depth = 0.75, extend = 1.15, width = 1.15 }, -- squeeze: glyph, height, depth: bbox - -- ["0x7C.variants.*"] = { squeeze = 0.75, height = 0.8, depth = 0.8, extend = 1.1, width = 1.1 }, -- squeeze: glyph, height, depth: bbox - - ["0x7C.variants.1"]={ squeeze = 0.90, height = 0.90, depth = 0.90 }, - ["0x7C.variants.2"]={ squeeze = 0.85, height = 0.85, depth = 0.85 }, - ["0x7C.variants.3"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, - ["0x7C.variants.4"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, - ["0x7C.variants.5"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, - ["0x7C.variants.6"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, - ["0x7C.variants.7"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, - - -- [utf.byte("1")] = { - -- original = utf.byte("2"), - -- mode = 1, - -- scale = 2, - -- }, - - -- ["lowercasegreeksansserifbolditalic"] = { - -- delta = 0x003B1 - 0x1D7AA, - -- slant = 0.4, - -- slant = -0.2, - -- line = 0.1, - -- mode = 1, - -- width = 1.25, - -- width = 0.95, - -- scale = 0.975, - -- }, - }, - }, - - -- Accents are a mess. We migrate the extensibles from the combiners to the base accent - -- and then need to tweak the width (which is auto set because it was zero with a large - -- accent anchor offset). First we copy and fix. - { - tweak = "extendaccents", - }, - { - tweak = "fixaccents", - }, - -- First we set the dimensions of the initial accent which started out as zero but we want - -- a proper width. - { - tweak = "dimensions", - list = { - -- [0x00300] = { width = 0.8 }, -- widegrave - -- [0x00301] = { width = 0.9 }, -- wideacute - [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat - [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde - [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve - -- [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering - [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck - }, - }, - -- Then we deal with all offsets and heights in one go. So we treat the initial accent - -- as well as the variants here. - { - tweak = "dimensions", - list = { - -- here we want to apply to all - -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 - -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 - -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 - -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC - -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 - -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA - -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 - -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF - -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 - -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 - [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) - }, - }, - -- We now copy these to the not wide slots so that we can set these to stretch as well, - -- if only because it is less confusing and more consistent. - { - tweak = "copyaccents", - }, - -- So far for the accents. - - { - -- Here we modify "corner kerns". - -- We started with 0x2F, the solidus - -- to have the 2 in x^2/5 a bit over the slash - tweak = "kerns", - list = { - [0x0002F] = { topleft = -0.2, bottomright = -0.2 }, -- solidus - -- - [0x1D49C] = { bottomright = -0.05, }, -- script A - [0x1D49D] = { bottomright = -0.05, }, -- script B - [0x1D49E] = { bottomright = -0.25, }, -- script C - [0x1D49F] = { bottomright = -0.11, }, -- script D - [0x1D4A0] = { bottomright = -0.18, }, -- script E - [0x1D4A1] = { bottomright = -0.30, }, -- script F - [0x1D4A2] = { bottomright = -0.11, }, -- script G - [0x1D4A3] = { bottomright = -0.18, }, -- script H - [0x1D4A4] = { bottomright = -0.25, }, -- script I - [0x1D4A5] = { bottomright = -0.25, }, -- script J - [0x1D4A6] = { bottomright = -0.11, }, -- script K - [0x1D4A7] = { bottomright = -0.05, }, -- script L - [0x1D4A8] = { bottomright = -0.11, }, -- script M - [0x1D4A9] = { bottomright = -0.18, }, -- script N - [0x1D4AA] = { bottomright = -0.05, }, -- script O - [0x1D4AB] = { bottomright = -0.25, }, -- script P - [0x1D4AC] = { bottomright = -0.05, }, -- script Q - [0x1D4AD] = { bottomright = -0.05, }, -- script R - [0x1D4AE] = { bottomright = -0.11, }, -- script S - [0x1D4AF] = { bottomright = -0.33, }, -- script T - [0x1D4B0] = { bottomright = -0.11, }, -- script U - [0x1D4B1] = { bottomright = -0.25, }, -- script V - [0x1D4B2] = { bottomright = -0.25, }, -- script W - [0x1D4B3] = { bottomright = -0.11, }, -- script X - [0x1D4B4] = { bottomright = -0.18, }, -- script Y - [0x1D4B5] = { bottomright = -0.05, }, -- script Z - -- - ["0x7D.parts.top"] = { topright = -0.25 }, -- right brace top - ["0x7D.parts.bottom"] = { bottomright = -0.25 }, -- right brace bottom - ["0x7D.variants.*"] = { topright = -0.25, bottomright = -0.25 }, -- right brace variants - ["0x29.parts.top"] = { topright = -0.3, }, -- right parenthesis top - ["0x29.parts.bottom"] = { bottomright = -0.3 }, -- right parenthesis bottom - ["0x29.variants.*"] = { topright = -0.25, bottomright = -0.25 }, -- right parenthesis variants - ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top - ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom - ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants - [0x27E9] = { topright = -0.2, bottomright = -0.2 }, -- angles - ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 }, - [0x27EB] = { topright = -0.2, bottomright = -0.2 }, - ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, - - }, - }, - -- { - -- tweak = "staircase", - -- list = { - -- }, - -- }, - { - -- This one fakes margins to get larger/smaller accents - -- with for example \widetilde. - tweak = "margins", - list = { - [0x1D487] = { left = -.2, right = -.2 }, -- bold italic f - [0x1D489] = { left = -.2, right = -.2 }, -- bold italic h - [0x1D496] = { left = -.1, right = -.1 }, -- bold italic u - [0x1D499] = { left = -.1, right = -.1 }, -- bold italic x - - [0x1D711] = { left = -.1, right = -.1 }, -- italic varphi - [0x1D713] = { left = -.1, right = -.1 }, -- italic psi - - [0x1D659] = { left = -.1, right = -.1 }, -- sans bold italic d - [0x1D65C] = { left = -.1, right = -.1 }, -- sans bold italic g - - [0x1D409] = { left = .1, right = .1 }, -- bold upright J - [0x1D412] = { left = .1, right = .1 }, -- bold upright S - - [0x1D509] = { left = .1, right = .1 }, -- fraktur F - [0x1D50C] = { left = .1, right = .1 }, -- fraktur I - [0x1D50D] = { left = .1, right = .1 }, -- fraktur J - [0x1D51D] = { left = .1, right = .1 }, -- fraktur Z - - [0x1D538] = { left = .1, right = .1 }, -- doublestruck A - [0x1D539] = { left = .1, right = .1 }, -- doublestruck B - [0x1D53C] = { left = .1, right = .1 }, -- doublestruck E - [0x1D53D] = { left = .1, right = .1 }, -- doublestruck F - [0x1D541] = { left = .1, right = .1 }, -- doublestruck J - [0x1D542] = { left = .1, right = .1 }, -- doublestruck K - [0x1D543] = { left = .1, right = .1 }, -- doublestruck L - [0x1D547] = { left = .1, right = .1 }, -- doublestruck P - [0x1D549] = { left = .1, right = .1 }, -- doublestruck R - [0x1D54A] = { left = .1, right = .1 }, -- doublestruck S - [0x1D54B] = { left = .1, right = .1 }, -- doublestruck T - [0x1D54D] = { left = .1, right = .1 }, -- doublestruck V - [0x1D550] = { left = .1, right = .1 }, -- doublestruck Y - - [0x1D506] = { left = .1, right = .1 }, -- fraktur C - - [0x00393] = { left = .1, right = .1 }, -- upfight Gamma - [0x00396] = { left = .1, right = .1 }, -- upfight Zeta - - [0x1D5D8] = { left = .1, right = .1 }, -- sans bold E - [0x1D5D9] = { left = .1, right = .1 }, -- sans bold F - -- [0x1D5DD] = { left = .2, right = .2 }, -- sans bold J -- nope - [0x1D5DF] = { left = .1, right = .1 }, -- sans bold L - [0x1D5E6] = { left = .1, right = .1 }, -- sans bold S - - [0x1D61A] = { left = .1, right = .1 }, -- sans italic S - - [0x1D5A2] = { left = .1, right = .1 }, -- sans C - [0x1D5A4] = { left = .1, right = .1 }, -- sans E - [0x1D5A5] = { left = .1, right = .1 }, -- sans F - -- [0x1D5AB] = { left = .1, right = .1 }, -- sans L -- nope - [0x1D5AF] = { left = .1, right = .1 }, -- sans P - [0x1D5B2] = { left = .1, right = .1 }, -- sans S - [0x1D5B9] = { left = .1, right = .1 }, -- sans Z - - [0x1D4A0] = { left = .1, right = .1 }, -- script E - [0x1D4AE] = { left = .1, right = .1 }, -- script S - [0x1D4B4] = { left = .1, right = .1 }, -- script Y - - -- [0x0004A] = { left = .2, right = .2 }, -- J - [0x0004C] = { left = .1, right = .1 }, -- L - [0x00053] = { left = .1, right = .1 }, -- S - [0x0005A] = { left = .1, right = .1 }, -- Z - - [0x1D43D] = { left = -.1, right = -.1 }, -- italic J - [0x1D409] = { left = -.1, right = -.1 }, -- bold J - [0x1D471] = { left = -.1, right = -.1 }, -- bold italic J - [0x1D4D9] = { left = -.05, right = -.05 }, -- bold script J - }, - }, - { - tweak = "fixprimes", - factor = 1.05, - -- smaller = true, - scale = 0.9, - -- fake = 0.6, - }, - { - tweak = "checkspacing", - }, - { - tweak = "fixradicals", - }, - { - tweak = "addprivates", - }, - { - tweak = "addscripts", - }, - { - tweak = "accentdimensions", - }, - { - tweak = "addrules", - }, - { - tweak = "addbars", - advance = 0.52, - }, - { - tweak = "addactuarian", - }, - { - tweak = "addfourier", - variant = 1, - }, - { - tweak = "addequals", - }, - -- { - -- tweak = "wipevariants", - -- list = { - -- 0x7C, - -- }, - -- }, - -- this is the mkiv section - { - tweak = "emulatelmtx", - feature = "emulatelmtx", - comment = "this is for mkiv", - }, - }, - }, - bigslots = { - 1, 3, 5, 7 -- In fact, 6 is the last one. - }, - }, - filenames = { - ["latinmodern-math-regular.otf"] = { - "latinmodern-math.otf", -- the beta - "lmmath-regular.otf", - "latinmodernmath-regular.otf", - "lmmath-regular.otf", - "lmodernmath-regular.otf", - "lmodern-math.otf", - }, - }, + -- filenames = { + -- ["latinmodern-math-regular.otf"] = { + -- "latinmodern-math.otf", -- the beta + -- "lmmath-regular.otf", + -- "latinmodernmath-regular.otf", + -- "lmmath-regular.otf", + -- "lmodernmath-regular.otf", + -- "lmodern-math.otf", + -- }, + -- }, designsizes = { ["LMMathRoman-Regular"] = { ["4pt"] = "LMMath5-Regular@lmroman5-math", @@ -610,92 +204,3 @@ return { } } --- For now we keep these commented as they show where we came from. - --- [0x00060] = { yoffset = -0.05 }, -- grave --- [0x000B4] = { yoffset = -0.05 }, -- acute --- [0x002C6] = { yoffset = -0.05 }, -- hat --- [0x002DC] = { yoffset = -0.05 }, -- tilde --- [0x000AF] = { yoffset = -0.075 }, -- bar --- [0x002D8] = { yoffset = -0.05 }, -- breve --- [0x002D9] = { yoffset = -0.05 }, -- dot --- [0x000A8] = { yoffset = -0.05 }, -- ddot --- [0x020DB] = { yoffset = 0.2 }, -- dddot (done below!) --- [0x002DA] = { width = 0 }, -- ring (bounding box is wrong) --- [0x002C7] = { yoffset = -0.05 }, -- check --- [0x020D7] = { yoffset = -0.05 }, -- vec - --- [0x00300] = { yoffset = -0.03, all = true }, -- widegrave --- [0x00301] = { yoffset = -0.03, all = true }, -- wideacute --- [0x00302] = { yoffset = -0.075, all = true }, -- widehat --- [0x00303] = { yoffset = -0.05, all = true }, -- widetilde --- [0x00304] = { yoffset = -0.02, all = true }, -- widebar --- [0x00306] = { yoffset = -0.05, all = true }, -- widebreve --- [0x00307] = { yoffset = -0.027, all = true }, -- widedot --- [0x00308] = { yoffset = -0.027, all = true }, -- wideddot --- [0x020DB] = { yoffset = -0.065, all = true }, -- widedddot --- [0x0030C] = { yoffset = -0.05, all = true }, -- widecheck --- [0x0030A] = { yoffset = -0.025, all = true }, -- widering - --- [0x0212C] = { width = 0.95, italic = 0.05 }, -- script B --- [0x1D49E] = { width = 0.8, italic = 0.25 }, -- script C --- [0x1D49F] = { width = 0.9, italic = 0.11 }, -- script D --- [0x02130] = { width = 0.85, italic = 0.18 }, -- script E --- [0x02131] = { width = 0.75, italic = 0.3 }, -- script F --- [0x1D4A2] = { width = 0.9, italic = 0.11 }, -- script G --- [0x0210B] = { width = 0.85, italic = 0.18 }, -- script H --- [0x02110] = { width = 0.8, italic = 0.25 }, -- script I --- [0x1D4A5] = { width = 0.8, italic = 0.25 }, -- script J --- [0x1D4A6] = { width = 0.9, italic = 0.11 }, -- script K --- [0x02112] = { width = 0.95, italic = 0.05 }, -- script L --- [0x02133] = { width = 0.9, italic = 0.11 }, -- script M --- [0x1D4A9] = { width = 0.85, italic = 0.18 }, -- script N --- [0x1D4AA] = { width = 0.95, italic = 0.05 }, -- script O --- [0x1D4AB] = { width = 0.8, italic = 0.25 }, -- script P --- [0x1D4AB] = { width = 0.95, italic = 0.05 }, -- script Q --- [0x0211B] = { width = 0.95, italic = 0.05 }, -- script R --- [0x1D4AE] = { width = 0.9, italic = 0.11 }, -- script S --- [0x1D4AF] = { width = 0.75, italic = 0.33 }, -- script T --- [0x1D4B0] = { width = 0.9, italic = 0.11 }, -- script U --- [0x1D4B1] = { width = 0.8, italic = 0.25 }, -- script V --- [0x1D4B2] = { width = 0.8, italic = 0.25 }, -- script W --- [0x1D4B3] = { width = 0.9, italic = 0.11 }, -- script X --- [0x1D4B4] = { width = 0.85, italic = 0.18 }, -- script Y --- [0x1D4B5] = { width = 0.95, italic = 0.05 }, -- script Z - --- Setting anchors to shift the location of accents --- Note: Many non-italic alphabets are wiped below --- Todo: Check the less common italic alphabets - --- { --- -- For non-italic alphabets we --- -- remove italic correction. --- tweak = "wipeitalics", --- list = { --- -- "digitsbold", --- -- "digitsdoublestruck", --- -- "digitsmonospace", --- -- "digitsnormal", --- -- "digitssansserifbold", --- -- "digitssansserifnormal", --- -- "lowercasebold", --- -- "lowercaseboldfraktur", --- -- "lowercasedoublestruck", --- -- "lowercasefraktur", --- "lowercasemonospace", --- -- "lowercasenormal", --- -- "lowercasesansserifbold", --- -- "lowercasesansserifnormal", --- -- "lowercasegreeknormal", --- "uppercasebold", --- -- "uppercaseboldfraktur", --- -- "uppercasedoublestruck", --- -- "uppercasefraktur", --- -- "uppercasegreekbold", --- -- "uppercasegreeknormal", --- -- "uppercasegreeksansserifbold", --- "uppercasemonospace", --- "uppercasesansserifbold", --- "uppercasesanserifnormal", --- }, --- }, diff --git a/tex/context/fonts/mkiv/lucida-opentype-math.lfg b/tex/context/fonts/mkiv/lucida-math.lfg index 6a5f5ab36..6842d505b 100644 --- a/tex/context/fonts/mkiv/lucida-opentype-math.lfg +++ b/tex/context/fonts/mkiv/lucida-math.lfg @@ -13,24 +13,24 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - RadicalDisplayStyleVerticalGap = 100, - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, + -- RadicalDisplayStyleVerticalGap = 100, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, FractionRuleThickness = 55, -- AccentTopShiftUp = 0, -- FlattenedAccentTopShiftUp = 0, -- AccentExtendMargin = 50, - -- AccentBaseHeight = 650, - AccentBaseDepth = 150, - RadicalDegreeBottomRaisePercent = 50, - RadicalKernAfterDegree = -600, + -- AccentBaseHeight = 650, + AccentBaseDepth = 250, + -- RadicalDegreeBottomRaisePercent = 50, + -- RadicalKernAfterDegree = -600, -- RadicalRuleThickness = 35, -- 40 in font (46 in demi) DelimiterPercent = 90, DelimiterShortfall = 400, -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) PrimeRaisePercent = 60, -- 50 default PrimeRaiseComposedPercent = 50, -- 25 default - -- AxisHeight = 325, -- we keep the old fonts as they are (also for demos) + AxisHeight = 325, -- we keep the old fonts as they are (also for demos) }, tweaks = { aftercopying = { @@ -122,6 +122,22 @@ return { { tweak = "extendaccents", }, +{ + tweak = "radicaldegreeanchors", + list = { + -- [0x221A] = { location = "left", hfactor = .05, vfactor = .675 }, + -- ["0x221A.variants.*"] = { location = "left", hfactor = .05, vfactor = .6 }, + -- ["0x221A.variants.1"] = { location = "left", hfactor = .05, vfactor = .65 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .65 }, + ["0x221A.variants.3"] = { location = "left", hfactor = 0, vfactor = .55 }, + ["0x221A.variants.4"] = { location = "left", hfactor = 0, vfactor = .50 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .05, vfactor = .525 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = 0, vfactor = .85 }, + } +}, { tweak = "fixaccents", }, @@ -165,9 +181,9 @@ return { { tweak = "fixslashes", }, - { - tweak = "fixellipses", - }, + -- { + -- tweak = "fixellipses", + -- }, { tweak = "addbreve", }, @@ -188,15 +204,15 @@ return { ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 }, [0x27EB] = { topright = -0.2, bottomright = -0.2 }, ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, - ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, - ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, - ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, - ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, - ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, - ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, - ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, - ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, - ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, + -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, + -- ["0x222C.variants.*"] = integral_variants, -- ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, + -- ["0x222D.variants.*"] = integral_variants, -- ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, + -- ["0x222E.variants.*"] = integral_variants, -- ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, + -- ["0x222F.variants.*"] = integral_variants, -- ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, + -- ["0x2230.variants.*"] = integral_variants, -- ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, + -- ["0x2231.variants.*"] = integral_variants, -- ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, + -- ["0x2232.variants.*"] = integral_variants, -- ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, + -- ["0x2233.variants.*"] = integral_variants, -- ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, }, }, @@ -205,7 +221,7 @@ return { factor = 0.8, -- accent base height -- smaller = true, -- replace multiples scale = 1.1, -- glyph scale - -- fake = 0.65, -- replace multiples with this width proportion + fake = 0.65, -- replace multiples with this width proportion -- keep = true, -- keep the text size prime (aka minute) }, { diff --git a/tex/context/fonts/mkiv/minion-math.lfg b/tex/context/fonts/mkiv/minion-math.lfg index a768c0518..82b0b0c33 100644 --- a/tex/context/fonts/mkiv/minion-math.lfg +++ b/tex/context/fonts/mkiv/minion-math.lfg @@ -26,8 +26,8 @@ return { }, mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, -- AccentTopShiftUp = -15, -- FlattenedAccentTopShiftUp = -15, -- AccentExtendMargin = 50, @@ -43,8 +43,8 @@ return { PrimeRaiseComposedPercent = 25, -- 25 default -- PrimeShiftUp = 0, -- PrimeBaselineDropMax = 0, - RadicalKernAfterExtensible = 100, -- 0 default - RadicalKernBeforeExtensible = 100, -- 0 default + -- RadicalKernAfterExtensible = 100, -- 0 default + -- RadicalKernBeforeExtensible = 100, -- 0 default }, tweaks = { aftercopying = { @@ -71,6 +71,23 @@ return { { tweak = "extendaccents", }, +{ + tweak = "radicaldegreeanchors", + list = { + [0x221A] = { location = "left", hfactor = -0.15, vfactor = .75 }, + ["0x221A.variants.*"] = { location = "left", hfactor = -0.1, vfactor = .575 }, + ["0x221A.variants.1"] = { location = "left", hfactor = -0.1, vfactor = .725 }, + ["0x221A.variants.2"] = { location = "left", hfactor = -0.1, vfactor = .65 }, + ["0x221A.variants.3"] = { location = "left", hfactor = -0.1, vfactor = .625 }, + ["0x221A.variants.4"] = { location = "left", hfactor = -0.1, vfactor = .625 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = 0.05, vfactor = .525 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = -0.1, vfactor = 0.85 }, + } +}, + { tweak = "fixaccents", }, diff --git a/tex/context/fonts/mkiv/modern-math.lfg b/tex/context/fonts/mkiv/modern-math.lfg new file mode 100644 index 000000000..509e5a7da --- /dev/null +++ b/tex/context/fonts/mkiv/modern-math.lfg @@ -0,0 +1,525 @@ +-- In order to be able to use beta math fonts, we use our own file name and +-- always remap. + +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + +return { + name = "latin modern math", + version = "1.00", + comment = "Goodies that complement latin modern math.", + author = "Hans Hagen & Mikael Sundqvist", + copyright = "ConTeXt development team", + mathematics = { + parameters = { + FractionNumeratorDisplayStyleShiftUp = 600, -- used to be a function + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, + AccentTopShiftUp = -60, + FlattenedAccentTopShiftUp = -60, + -- AccentExtendMargin = 50, + -- AccentBaseHeight = 0, + -- AccentBaseDepth = 0, + -- AccentTopOvershoot = 66, + AccentSuperscriptDrop = 100, -- drop the superscripts if accents are present. Amount in percentage of height of accent(?) + AccentSuperscriptPercent = 0, + DelimiterPercent = 90, + DelimiterShortfall = 400, + -- DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) + PrimeRaisePercent = 60, + PrimeRaiseComposedPercent = 15, + -- SubSuperscriptGapMin = 160, -- 160 in font + SuperscriptBaselineDropMax = 250, -- 250 in font + -- SuperscriptBottomMaxWithSubscript = 344, -- 344 in font + -- SuperscriptBottomMin = 108, -- 108 in font + SuperscriptShiftUp = 363, -- 363 in font + SuperscriptShiftUpCramped = 89, -- 289 in font + }, + tweaks = { + aftercopying = { + { + tweak = "version", + expected = "Version 1.958", + }, + { + tweak = "addmirrors", + }, + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { rscale = 0.80 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.4 }, + presets.wipeanchors { }, + presets.wipeitalics { }, + -- these will become moveanchors + { + tweak = "dimensions", + list = { + -- [0x1D483] = { anchor = 1.15 }, -- bold italic b + -- [0x1D485] = { anchor = 0.8 }, -- bold italic d + [0x1D487] = { anchor = 0.9 }, -- bold italic f + [0x1D489] = { anchor = 1.2 }, -- bold italic h + [0x1D48C] = { anchor = 1.2 }, -- bold italic k + [0x1D48F] = { anchor = 1.1 }, -- bold italic n + [0x1D491] = { anchor = 1.2 }, -- bold italic p + [0x1D492] = { anchor = 0.9 }, -- bold italic q + [0x1D49B] = { anchor = 0.9 }, -- bold italic z + + [0x1D736] = { anchor = 0.9 }, -- bold italic alpha + [0x1D737] = { anchor = 0.9 }, -- bold italic beta + [0x1D738] = { anchor = 1.1 }, -- bold italic gamma + [0x1D740] = { anchor = 1.2 }, -- bold italic lambda + [0x1D744] = { anchor = 1.2 }, -- bold italic omicron + + [0x1D6FE] = { anchor = 1.1 }, -- italic gamma + [0x1D702] = { anchor = 1.1 }, -- italic eta + -- [0x1D70A] = { anchor = 1.2 }, -- italic omicron -- no difference + -- [0x1D70D] = { anchor = 1.2 }, -- italic varsigma -- no difference + + [0x1D44F] = { anchor = 1.15 }, -- italic b + [0x1D451] = { anchor = 0.8, }, -- italic d + [0x1D455] = { anchor = 1.15 }, -- italic h + -- [0x1D456] = { anchor = 1.15 }, -- italic i (wrong code?) + [0x1D458] = { anchor = 1.15 }, -- italic k + [0x1D45B] = { anchor = 1.1 }, -- italic n + [0x1D45D] = { anchor = 1.1 }, -- italic p + [0x1D45E] = { anchor = 0.9 }, -- italic q + [0x1D467] = { anchor = 0.9 }, -- italic z + + [0x1D6FE] = { anchor = 1.2 }, -- italic gamma + [0x1D706] = { anchor = 1.2 }, -- italic lambda + [0x1D70A] = { anchor = 1.1 }, -- italic omikron + [0x1D70D] = { anchor = 1.1 }, -- italic varsigma + + [0x1D46A] = { anchor = 0.75 }, -- bold italic C + [0x1D46B] = { anchor = 1.1 }, -- bold italic D + [0x1D46E] = { anchor = 0.75 }, -- bold italic G + [0x1D479] = { anchor = 1.2 }, -- bold italic R + [0x1D47A] = { anchor = 0.8 }, -- bold italic S + + -- uppercaseboldscript could be improved + + [0x1D435] = { anchor = 1.05 }, -- italic B + [0x1D436] = { anchor = 0.7 }, -- italic C + [0x1D437] = { anchor = 1.05 }, -- italic D + [0x1D43A] = { anchor = 0.8 }, -- italic G + [0x1D443] = { anchor = 1.1 }, -- italic P + [0x1D445] = { anchor = 1.05 }, -- italic R + [0x1D446] = { anchor = 0.85 }, -- italic S + + [0x1D49C] = { anchor = 0.9 }, -- script A + [0x1D49D] = { anchor = 0.95 }, -- script B + [0x1D49E] = { anchor = 0.8 }, -- script C + [0x1D49F] = { anchor = 0.95 }, -- script D + [0x1D4A0] = { anchor = 0.85 }, -- script E + [0x1D4A1] = { anchor = 0.75 }, -- script F + [0x1D4A2] = { anchor = 0.9 }, -- script G + [0x1D4A3] = { anchor = 0.85 }, -- script H + [0x1D4A4] = { anchor = 0.8 }, -- script I + [0x1D4A5] = { anchor = 0.8 }, -- script J + [0x1D4A6] = { anchor = 0.85 }, -- script K + [0x1D4A7] = { anchor = 0.75 }, -- script L + [0x1D4A8] = { anchor = 0.9 }, -- script M + [0x1D4A9] = { anchor = 0.85 }, -- script N + [0x1D4AA] = { anchor = 0.95 }, -- script O + [0x1D4AB] = { anchor = 0.95 }, -- script P + [0x1D4AC] = { anchor = 0.95 }, -- script Q + [0x1D4AD] = { anchor = 0.95 }, -- script R + [0x1D4AE] = { anchor = 0.9 }, -- script S + [0x1D4AF] = { anchor = 0.75 }, -- script T + [0x1D4B0] = { anchor = 0.9, }, -- script U + [0x1D4B1] = { anchor = 0.95 }, -- script V + [0x1D4B2] = { anchor = 0.95 }, -- script W + [0x1D4B3] = { anchor = 0.95 }, -- script X + [0x1D4B4] = { anchor = 0.9 }, -- script Y + [0x1D4B5] = { anchor = 1 }, -- script Z + + -- [984874] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, + -- [984881] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, + -- [984888] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, + -- [984895] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, + -- [984902] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, + -- [984909] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, + -- [984916] = { squeeze = 0.50, height = 0.50, depth = 0.50 }, + + -- ["0x7C.variants.*"] = { squeeze = 0.75, height = 0.75, depth = 0.75, extend = 1.15, width = 1.15 }, -- squeeze: glyph, height, depth: bbox + -- ["0x7C.variants.*"] = { squeeze = 0.75, height = 0.8, depth = 0.8, extend = 1.1, width = 1.1 }, -- squeeze: glyph, height, depth: bbox + + ["0x7C.variants.1"]={ squeeze = 0.90, height = 0.90, depth = 0.90 }, + ["0x7C.variants.2"]={ squeeze = 0.85, height = 0.85, depth = 0.85 }, + ["0x7C.variants.3"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, + ["0x7C.variants.4"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, + ["0x7C.variants.5"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, + ["0x7C.variants.6"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, + ["0x7C.variants.7"]={ squeeze = 0.80, height = 0.80, depth = 0.80 }, + + -- [utf.byte("1")] = { + -- original = utf.byte("2"), + -- mode = 1, + -- scale = 2, + -- }, + + -- ["lowercasegreeksansserifbolditalic"] = { + -- delta = 0x003B1 - 0x1D7AA, + -- slant = 0.4, + -- slant = -0.2, + -- line = 0.1, + -- mode = 1, + -- width = 1.25, + -- width = 0.95, + -- scale = 0.975, + -- }, + }, + }, + + -- Accents are a mess. We migrate the extensibles from the combiners to the base accent + -- and then need to tweak the width (which is auto set because it was zero with a large + -- accent anchor offset). First we copy and fix. + { + tweak = "extendaccents", + }, + +{ + tweak = "radicaldegreeanchors", + list = { + -- [0x221A] = { location = "left", hfactor = 0.05, vfactor = .675 }, + -- ["0x221A.variants.*"] = { location = "left", hfactor = 0.05, vfactor = .6 }, + -- ["0x221A.variants.1"] = { location = "left", hfactor = 0.05, vfactor = .65 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .65 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = 0.05, vfactor = .525 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.05 }, + } +}, + + { + tweak = "fixaccents", + }, + -- First we set the dimensions of the initial accent which started out as zero but we want + -- a proper width. + { + tweak = "dimensions", + list = { + -- [0x00300] = { width = 0.8 }, -- widegrave + -- [0x00301] = { width = 0.9 }, -- wideacute + [0x00302] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widehat + [0x00303] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widetilde + [0x00306] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widebreve + -- [0x0030A] = { width = 0.9, xoffset = -.0 }, -- widering + [0x0030C] = { width = 1.4, anchor = 1.20, xoffset = .10 }, -- widecheck + }, + }, + -- Then we deal with all offsets and heights in one go. So we treat the initial accent + -- as well as the variants here. + { + tweak = "dimensions", + list = { + -- here we want to apply to all + -- [0x00300] = { yoffset = -0.02, height = .95, all = true }, -- widegrave : 0x0060 + -- [0x00301] = { yoffset = -0.02, height = .95, all = true }, -- wideacute : 0x00B4 + -- [0x00302] = { yoffset = -0.03, height = .95, all = true }, -- widehat : 0x02C6 + -- [0x00303] = { yoffset = -0.02, height = .95, all = true }, -- widetilde : 0x02DC + -- [0x00306] = { yoffset = -0.03, height = .95, all = true }, -- widebre : 0x02D8 + -- [0x0030A] = { yoffset = 0.00, height = .95, all = true }, -- widering : 0x02DA + -- [0x0030C] = { yoffset = -0.03, height = .95, all = true }, -- widecheck : 0x02C7 + -- [0x00304] = { yoffset = -0.05, height = .95, all = true }, -- widebar : 0x00AF + -- [0x00307] = { yoffset = -0.03, height = .95, all = true }, -- widedot : 0x02D9 + -- [0x00308] = { yoffset = -0.03, height = .95, all = true }, -- wideddot : 0x00A8 + [0x020DB] = { yoffset = -0.015, height = .95, all = true }, -- widedddot : 0x20DB (self) + }, + }, + -- We now copy these to the not wide slots so that we can set these to stretch as well, + -- if only because it is less confusing and more consistent. + { + tweak = "copyaccents", + }, + -- So far for the accents. + + { + -- Here we modify "corner kerns". + -- We started with 0x2F, the solidus + -- to have the 2 in x^2/5 a bit over the slash + tweak = "kerns", + list = { + [0x0002F] = { topleft = -0.2, bottomright = -0.2 }, -- solidus + -- + [0x1D49C] = { bottomright = -0.05, }, -- script A + [0x1D49D] = { bottomright = -0.05, }, -- script B + [0x1D49E] = { bottomright = -0.25, }, -- script C + [0x1D49F] = { bottomright = -0.11, }, -- script D + [0x1D4A0] = { bottomright = -0.18, }, -- script E + [0x1D4A1] = { bottomright = -0.30, }, -- script F + [0x1D4A2] = { bottomright = -0.11, }, -- script G + [0x1D4A3] = { bottomright = -0.18, }, -- script H + [0x1D4A4] = { bottomright = -0.25, }, -- script I + [0x1D4A5] = { bottomright = -0.25, }, -- script J + [0x1D4A6] = { bottomright = -0.11, }, -- script K + [0x1D4A7] = { bottomright = -0.05, }, -- script L + [0x1D4A8] = { bottomright = -0.11, }, -- script M + [0x1D4A9] = { bottomright = -0.18, }, -- script N + [0x1D4AA] = { bottomright = -0.05, }, -- script O + [0x1D4AB] = { bottomright = -0.25, }, -- script P + [0x1D4AC] = { bottomright = -0.05, }, -- script Q + [0x1D4AD] = { bottomright = -0.05, }, -- script R + [0x1D4AE] = { bottomright = -0.11, }, -- script S + [0x1D4AF] = { bottomright = -0.33, }, -- script T + [0x1D4B0] = { bottomright = -0.11, }, -- script U + [0x1D4B1] = { bottomright = -0.25, }, -- script V + [0x1D4B2] = { bottomright = -0.25, }, -- script W + [0x1D4B3] = { bottomright = -0.11, }, -- script X + [0x1D4B4] = { bottomright = -0.18, }, -- script Y + [0x1D4B5] = { bottomright = -0.05, }, -- script Z + -- + ["0x7D.parts.top"] = { topright = -0.25 }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.25 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.25, bottomright = -0.25 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.3, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.3 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.25, bottomright = -0.25 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants + [0x27E9] = { topright = -0.2, bottomright = -0.2 }, -- angles + ["0x27E9.variants.*"] = { topright = -0.3, bottomright = -0.3 }, + [0x27EB] = { topright = -0.2, bottomright = -0.2 }, + ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, + + }, + }, + -- { + -- tweak = "staircase", + -- list = { + -- }, + -- }, + { + -- This one fakes margins to get larger/smaller accents + -- with for example \widetilde. + tweak = "margins", + list = { + [0x1D487] = { left = -.2, right = -.2 }, -- bold italic f + [0x1D489] = { left = -.2, right = -.2 }, -- bold italic h + [0x1D496] = { left = -.1, right = -.1 }, -- bold italic u + [0x1D499] = { left = -.1, right = -.1 }, -- bold italic x + + [0x1D711] = { left = -.1, right = -.1 }, -- italic varphi + [0x1D713] = { left = -.1, right = -.1 }, -- italic psi + + [0x1D659] = { left = -.1, right = -.1 }, -- sans bold italic d + [0x1D65C] = { left = -.1, right = -.1 }, -- sans bold italic g + + [0x1D409] = { left = .1, right = .1 }, -- bold upright J + [0x1D412] = { left = .1, right = .1 }, -- bold upright S + + [0x1D509] = { left = .1, right = .1 }, -- fraktur F + [0x1D50C] = { left = .1, right = .1 }, -- fraktur I + [0x1D50D] = { left = .1, right = .1 }, -- fraktur J + [0x1D51D] = { left = .1, right = .1 }, -- fraktur Z + + [0x1D538] = { left = .1, right = .1 }, -- doublestruck A + [0x1D539] = { left = .1, right = .1 }, -- doublestruck B + [0x1D53C] = { left = .1, right = .1 }, -- doublestruck E + [0x1D53D] = { left = .1, right = .1 }, -- doublestruck F + [0x1D541] = { left = .1, right = .1 }, -- doublestruck J + [0x1D542] = { left = .1, right = .1 }, -- doublestruck K + [0x1D543] = { left = .1, right = .1 }, -- doublestruck L + [0x1D547] = { left = .1, right = .1 }, -- doublestruck P + [0x1D549] = { left = .1, right = .1 }, -- doublestruck R + [0x1D54A] = { left = .1, right = .1 }, -- doublestruck S + [0x1D54B] = { left = .1, right = .1 }, -- doublestruck T + [0x1D54D] = { left = .1, right = .1 }, -- doublestruck V + [0x1D550] = { left = .1, right = .1 }, -- doublestruck Y + + [0x1D506] = { left = .1, right = .1 }, -- fraktur C + + [0x00393] = { left = .1, right = .1 }, -- upfight Gamma + [0x00396] = { left = .1, right = .1 }, -- upfight Zeta + + [0x1D5D8] = { left = .1, right = .1 }, -- sans bold E + [0x1D5D9] = { left = .1, right = .1 }, -- sans bold F + -- [0x1D5DD] = { left = .2, right = .2 }, -- sans bold J -- nope + [0x1D5DF] = { left = .1, right = .1 }, -- sans bold L + [0x1D5E6] = { left = .1, right = .1 }, -- sans bold S + + [0x1D61A] = { left = .1, right = .1 }, -- sans italic S + + [0x1D5A2] = { left = .1, right = .1 }, -- sans C + [0x1D5A4] = { left = .1, right = .1 }, -- sans E + [0x1D5A5] = { left = .1, right = .1 }, -- sans F + -- [0x1D5AB] = { left = .1, right = .1 }, -- sans L -- nope + [0x1D5AF] = { left = .1, right = .1 }, -- sans P + [0x1D5B2] = { left = .1, right = .1 }, -- sans S + [0x1D5B9] = { left = .1, right = .1 }, -- sans Z + + [0x1D4A0] = { left = .1, right = .1 }, -- script E + [0x1D4AE] = { left = .1, right = .1 }, -- script S + [0x1D4B4] = { left = .1, right = .1 }, -- script Y + + -- [0x0004A] = { left = .2, right = .2 }, -- J + [0x0004C] = { left = .1, right = .1 }, -- L + [0x00053] = { left = .1, right = .1 }, -- S + [0x0005A] = { left = .1, right = .1 }, -- Z + + [0x1D43D] = { left = -.1, right = -.1 }, -- italic J + [0x1D409] = { left = -.1, right = -.1 }, -- bold J + [0x1D471] = { left = -.1, right = -.1 }, -- bold italic J + [0x1D4D9] = { left = -.05, right = -.05 }, -- bold script J + }, + }, + { + tweak = "fixprimes", + factor = 1.05, + -- smaller = true, + scale = 0.9, + -- fake = 0.6, + }, + { + tweak = "checkspacing", + }, + { + tweak = "fixradicals", + }, + { + tweak = "addprivates", + }, + { + tweak = "addscripts", + }, + { + tweak = "accentdimensions", + }, + { + tweak = "addrules", + }, + { + tweak = "addbars", + advance = 0.52, + }, + { + tweak = "addactuarian", + }, + { + tweak = "addfourier", + variant = 1, + }, + { + tweak = "addequals", + }, + -- { + -- tweak = "wipevariants", + -- list = { + -- 0x7C, + -- }, + -- }, + -- this is the mkiv section + { + tweak = "emulatelmtx", + feature = "emulatelmtx", + comment = "this is for mkiv", + }, + }, + }, + bigslots = { + -- 1, 3, 5, 7 -- In fact, 7 is the last one. + 1, 4, 6, 7 -- In fact, 7 is the last one. + }, + }, +} + +-- For now we keep these commented as they show where we came from. + +-- [0x00060] = { yoffset = -0.05 }, -- grave +-- [0x000B4] = { yoffset = -0.05 }, -- acute +-- [0x002C6] = { yoffset = -0.05 }, -- hat +-- [0x002DC] = { yoffset = -0.05 }, -- tilde +-- [0x000AF] = { yoffset = -0.075 }, -- bar +-- [0x002D8] = { yoffset = -0.05 }, -- breve +-- [0x002D9] = { yoffset = -0.05 }, -- dot +-- [0x000A8] = { yoffset = -0.05 }, -- ddot +-- [0x020DB] = { yoffset = 0.2 }, -- dddot (done below!) +-- [0x002DA] = { width = 0 }, -- ring (bounding box is wrong) +-- [0x002C7] = { yoffset = -0.05 }, -- check +-- [0x020D7] = { yoffset = -0.05 }, -- vec + +-- [0x00300] = { yoffset = -0.03, all = true }, -- widegrave +-- [0x00301] = { yoffset = -0.03, all = true }, -- wideacute +-- [0x00302] = { yoffset = -0.075, all = true }, -- widehat +-- [0x00303] = { yoffset = -0.05, all = true }, -- widetilde +-- [0x00304] = { yoffset = -0.02, all = true }, -- widebar +-- [0x00306] = { yoffset = -0.05, all = true }, -- widebreve +-- [0x00307] = { yoffset = -0.027, all = true }, -- widedot +-- [0x00308] = { yoffset = -0.027, all = true }, -- wideddot +-- [0x020DB] = { yoffset = -0.065, all = true }, -- widedddot +-- [0x0030C] = { yoffset = -0.05, all = true }, -- widecheck +-- [0x0030A] = { yoffset = -0.025, all = true }, -- widering + +-- [0x0212C] = { width = 0.95, italic = 0.05 }, -- script B +-- [0x1D49E] = { width = 0.8, italic = 0.25 }, -- script C +-- [0x1D49F] = { width = 0.9, italic = 0.11 }, -- script D +-- [0x02130] = { width = 0.85, italic = 0.18 }, -- script E +-- [0x02131] = { width = 0.75, italic = 0.3 }, -- script F +-- [0x1D4A2] = { width = 0.9, italic = 0.11 }, -- script G +-- [0x0210B] = { width = 0.85, italic = 0.18 }, -- script H +-- [0x02110] = { width = 0.8, italic = 0.25 }, -- script I +-- [0x1D4A5] = { width = 0.8, italic = 0.25 }, -- script J +-- [0x1D4A6] = { width = 0.9, italic = 0.11 }, -- script K +-- [0x02112] = { width = 0.95, italic = 0.05 }, -- script L +-- [0x02133] = { width = 0.9, italic = 0.11 }, -- script M +-- [0x1D4A9] = { width = 0.85, italic = 0.18 }, -- script N +-- [0x1D4AA] = { width = 0.95, italic = 0.05 }, -- script O +-- [0x1D4AB] = { width = 0.8, italic = 0.25 }, -- script P +-- [0x1D4AB] = { width = 0.95, italic = 0.05 }, -- script Q +-- [0x0211B] = { width = 0.95, italic = 0.05 }, -- script R +-- [0x1D4AE] = { width = 0.9, italic = 0.11 }, -- script S +-- [0x1D4AF] = { width = 0.75, italic = 0.33 }, -- script T +-- [0x1D4B0] = { width = 0.9, italic = 0.11 }, -- script U +-- [0x1D4B1] = { width = 0.8, italic = 0.25 }, -- script V +-- [0x1D4B2] = { width = 0.8, italic = 0.25 }, -- script W +-- [0x1D4B3] = { width = 0.9, italic = 0.11 }, -- script X +-- [0x1D4B4] = { width = 0.85, italic = 0.18 }, -- script Y +-- [0x1D4B5] = { width = 0.95, italic = 0.05 }, -- script Z + +-- Setting anchors to shift the location of accents +-- Note: Many non-italic alphabets are wiped below +-- Todo: Check the less common italic alphabets + +-- { +-- -- For non-italic alphabets we +-- -- remove italic correction. +-- tweak = "wipeitalics", +-- list = { +-- -- "digitsbold", +-- -- "digitsdoublestruck", +-- -- "digitsmonospace", +-- -- "digitsnormal", +-- -- "digitssansserifbold", +-- -- "digitssansserifnormal", +-- -- "lowercasebold", +-- -- "lowercaseboldfraktur", +-- -- "lowercasedoublestruck", +-- -- "lowercasefraktur", +-- "lowercasemonospace", +-- -- "lowercasenormal", +-- -- "lowercasesansserifbold", +-- -- "lowercasesansserifnormal", +-- -- "lowercasegreeknormal", +-- "uppercasebold", +-- -- "uppercaseboldfraktur", +-- -- "uppercasedoublestruck", +-- -- "uppercasefraktur", +-- -- "uppercasegreekbold", +-- -- "uppercasegreeknormal", +-- -- "uppercasegreeksansserifbold", +-- "uppercasemonospace", +-- "uppercasesansserifbold", +-- "uppercasesanserifnormal", +-- }, +-- }, diff --git a/tex/context/fonts/mkiv/pagella-math.lfg b/tex/context/fonts/mkiv/pagella-math.lfg index 032450426..8c60759ab 100644 --- a/tex/context/fonts/mkiv/pagella-math.lfg +++ b/tex/context/fonts/mkiv/pagella-math.lfg @@ -13,8 +13,8 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, AccentTopShiftUp = 10, FlattenedAccentTopShiftUp = 10, -- AccentExtendMargin = 50, @@ -22,9 +22,9 @@ return { AccentBaseDepth = 80, -- SpaceAfterScript = 0, -- SpaceAfterScript = 30, - RadicalDegreeBottomRaisePercent = 60, - RadicalKernAfterDegree = -500, - RadicalRuleThickness = 54, -- 60 in font + -- RadicalDegreeBottomRaisePercent = 60, + -- RadicalKernAfterDegree = -500, + -- RadicalRuleThickness = 54, -- 60 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1800, -- 1500 in font @@ -49,8 +49,8 @@ return { { tweak = "replacealphabets", feature = "euleroverpagella", - filename = "euler.otf", - list = { + filename = "euler-math.otf", + list = { -- { source = { first = 0x02100, last = 0x0210D } }, -- no 0x2210E -- { source = { first = 0x0210F, last = 0x02BFF } }, { source = { first = 0x02100, last = 0x02BFF } }, @@ -106,6 +106,22 @@ return { { tweak = "extendaccents", }, +{ + tweak = "radicaldegreeanchors", + list = { + -- [0x221A] = { location = "left", hfactor = 0.05 }, + -- ["0x221A.variants.*"] = { location = "left", hfactor = 0.05 }, + -- ["0x221A.variants.1"] = { location = "left", hfactor = 0.05, vfactor = .65 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .65 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = 0.05, vfactor = .525 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.0, vfactor = 1.1 }, + } +}, { tweak = "fixaccents", }, @@ -174,15 +190,19 @@ return { [0x27EB] = { topright = -0.2, bottomright = -0.2 }, ["0x27EB.variants.*"] = { topright = -0.3, bottomright = -0.3 }, -- - ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, - ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, - ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, - ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, - ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, - ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, - ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, - ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, - ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, + ["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int + ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint + ["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint + ["0x2A0C.parts.bottom"] = { bottomright = -0.05 }, -- iiiint + -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, + -- ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, + -- ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, + -- ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, + -- ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, + -- ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, + -- ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, + -- ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, + -- ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, }, }, { diff --git a/tex/context/fonts/mkiv/schola-math.lfg b/tex/context/fonts/mkiv/schola-math.lfg index 9a7b3dca6..8666690da 100644 --- a/tex/context/fonts/mkiv/schola-math.lfg +++ b/tex/context/fonts/mkiv/schola-math.lfg @@ -12,16 +12,16 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, AccentTopShiftUp = -15, FlattenedAccentTopShiftUp = -15, -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, AccentBaseDepth = 30, - RadicalDegreeBottomRaisePercent = 60, - RadicalKernAfterDegree = -500, - RadicalRuleThickness = 64, -- 70 in font + -- RadicalDegreeBottomRaisePercent = 60, + -- RadicalKernAfterDegree = -500, + -- RadicalRuleThickness = 64, -- 70 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1800, -- 1333 in font @@ -72,15 +72,19 @@ return { [0x27EB] = { topright = -0.1, bottomright = -0.1 }, ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- - ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, - ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, - ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, - ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, - ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, - ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, - ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, - ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, - ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, + ["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int + ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint + ["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint + ["0x2A0C.parts.bottom"] = { bottomright = -0.05 }, -- iiiint + -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, + -- ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, + -- ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, + -- ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, + -- ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, + -- ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, + -- ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, + -- ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, + -- ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, }, }, @@ -91,6 +95,22 @@ return { { tweak = "extendaccents", }, +{ + tweak = "radicaldegreeanchors", + list = { + -- [0x221A] = { location = "left", hfactor = 0.05 }, + -- ["0x221A.variants.*"] = { location = "left", hfactor = 0.05 }, + -- ["0x221A.variants.1"] = { location = "left", hfactor = 0.05, vfactor = .65 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .65 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = 0.05, vfactor = .525 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.1 }, + } +}, { tweak = "fixaccents", }, diff --git a/tex/context/fonts/mkiv/stix-two-math.lfg b/tex/context/fonts/mkiv/stixtwo-math.lfg index 1f370359f..ab5b884ad 100644 --- a/tex/context/fonts/mkiv/stix-two-math.lfg +++ b/tex/context/fonts/mkiv/stixtwo-math.lfg @@ -28,16 +28,16 @@ return { circled = { feature = 'ss16', value = 1, comment = "Mathematical Alternative Circled Operators" }, }, parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 1000, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 1000, -- AccentBaseHeight = 0, AccentBaseDepth = 30, FlattenedAccentTopShiftUp = 0, -- AccentExtendMargin = 50, - RadicalDegreeBottomRaisePercent = 65, + -- RadicalDegreeBottomRaisePercent = 65, -- RadicalKernBeforeDegree = 500, RadicalKernAfterDegree = -500, - RadicalVerticalGap = 10, + -- RadicalVerticalGap = 10, -- RadicalRuleThickness = 68, -- 68 in font (but shifted down) DelimiterPercent = 90, DelimiterShortfall = 400, @@ -108,15 +108,19 @@ return { [0x27EB] = { topright = -0.1, bottomright = -0.1 }, ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- - ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, - ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, - ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, - ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, - ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, - ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, - ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, - ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, - ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, + ["0x222B.parts.bottom"] = { bottomright = -0.30 }, -- int + -- ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint does not exist + -- ["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint does not exist + -- ["0x2A0C.parts.bottom"] = { bottomright = -0.05 }, -- iiiint does not exist + -- -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, + -- ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, + -- ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, + -- ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, + -- ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, + -- ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, + -- ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, + -- ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, + -- ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, }, }, -- Accents are a mess. We migrate the extensibles from the combiners to the base accent @@ -125,6 +129,24 @@ return { { tweak = "extendaccents", }, + +{ + tweak = "radicaldegreeanchors", + list = { + [0x221A] = { location = "left", hfactor = 0.00, vfactor = 0.7 }, + ["0x221A.variants.*"] = { location = "left", hfactor = 0.00, vfactor = 0.55 }, + -- ["0x221A.variants.1"] = { location = "left", hfactor = 0.05, vfactor = .65 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .65 }, + ["0x221A.variants.3"] = { location = "left", hfactor = 0.00, vfactor = .525 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = 0.05, vfactor = .525 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.00 }, + } +}, + { tweak = "fixaccents", }, diff --git a/tex/context/fonts/mkiv/termes-math.lfg b/tex/context/fonts/mkiv/termes-math.lfg index 6e3eb9306..cd4536b55 100644 --- a/tex/context/fonts/mkiv/termes-math.lfg +++ b/tex/context/fonts/mkiv/termes-math.lfg @@ -12,15 +12,15 @@ return { copyright = "ConTeXt development team", mathematics = { parameters = { - NoLimitSupFactor = 0, - NoLimitSubFactor = 900, + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, AccentTopShiftUp = -15, FlattenedAccentTopShiftUp = -15, -- AccentExtendMargin = 50, -- AccentBaseHeight = 0, AccentBaseDepth = 50, - RadicalDegreeBottomRaisePercent = 60, - RadicalRuleThickness = 46, -- 52 in font + -- RadicalDegreeBottomRaisePercent = 60, + -- RadicalRuleThickness = 46, -- 52 in font DelimiterPercent = 90, DelimiterShortfall = 400, DisplayOperatorMinHeight = 1800, -- 1300 in font (only one) @@ -71,15 +71,19 @@ return { [0x27EB] = { topright = -0.1, bottomright = -0.1 }, ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, -- - ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, - ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, - ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, - ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, - ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, - ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, - ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, - ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, - ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, + ["0x222B.parts.bottom"] = { bottomright = -0.20 }, -- int + ["0x222C.parts.bottom"] = { bottomright = -0.15 }, -- iint + ["0x222D.parts.bottom"] = { bottomright = -0.10 }, -- iiint + ["0x2A0C.parts.bottom"] = { bottomright = -0.05 }, -- iiiint + -- ["0x222B.variants.*"] = integral_variants, ["0x222B.parts.top"] = integral_top, ["0x222B.parts.bottom"] = integral_bottom, + -- ["0x222C.variants.*"] = integral_variants, ["0x222C.parts.top"] = integral_top, ["0x222C.parts.bottom"] = integral_bottom, + -- ["0x222D.variants.*"] = integral_variants, ["0x222D.parts.top"] = integral_top, ["0x222D.parts.bottom"] = integral_bottom, + -- ["0x222E.variants.*"] = integral_variants, ["0x222E.parts.top"] = integral_top, ["0x222E.parts.bottom"] = integral_bottom, + -- ["0x222F.variants.*"] = integral_variants, ["0x222F.parts.top"] = integral_top, ["0x222F.parts.bottom"] = integral_bottom, + -- ["0x2230.variants.*"] = integral_variants, ["0x2230.parts.top"] = integral_top, ["0x2230.parts.bottom"] = integral_bottom, + -- ["0x2231.variants.*"] = integral_variants, ["0x2231.parts.top"] = integral_top, ["0x2231.parts.bottom"] = integral_bottom, + -- ["0x2232.variants.*"] = integral_variants, ["0x2232.parts.top"] = integral_top, ["0x2232.parts.bottom"] = integral_bottom, + -- ["0x2233.variants.*"] = integral_variants, ["0x2233.parts.top"] = integral_top, ["0x2233.parts.bottom"] = integral_bottom, }, }, -- Accents are a mess. We migrate the extensibles from the combiners to the base accent @@ -88,6 +92,22 @@ return { { tweak = "extendaccents", }, +{ + tweak = "radicaldegreeanchors", + list = { + [0x221A] = { location = "left", hfactor = 0.0, vfactor = 0.6 }, + ["0x221A.variants.*"] = { location = "left", hfactor = 0.0, vfactor = 0.6 }, + -- ["0x221A.variants.1"] = { location = "left", hfactor = 0.05, vfactor = .65 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .65 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = 0.05, vfactor = .525 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = 0.05, vfactor = 1.1 }, + } +}, { tweak = "fixaccents", }, diff --git a/tex/context/fonts/mkiv/type-imp-asana.mkiv b/tex/context/fonts/mkiv/type-imp-asana.mkiv deleted file mode 100644 index c48d3b7ad..000000000 --- a/tex/context/fonts/mkiv/type-imp-asana.mkiv +++ /dev/null @@ -1,35 +0,0 @@ -%D \module -%D [ file=type-imp-asana, -%D version=2007.07.30, -%D title=\CONTEXT\ Typescript Macros, -%D subtitle=Asana, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\loadtypescriptfile[texgyre] - -\starttypescriptcollection [asanamath] - - \starttypescript [\s!math] [asana] - \definefontsynonym [AsanaMath] [\s!name:asanamath] - \stoptypescript - - \starttypescript [\s!math] [asana] [\s!name] - \loadfontgoodies[asana-math] - \definefontsynonym [MathRoman] [AsanaMath] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=asana-math] - \stoptypescript - - \starttypescript[asana] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [palatino] [\s!default] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.075] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.075] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] - \quittypescriptscanning - \stoptypescript - -\stoptypescriptcollection diff --git a/tex/context/fonts/mkiv/type-imp-cambria.mkiv b/tex/context/fonts/mkiv/type-imp-cambria.mkiv index 0ccb4409e..345778149 100644 --- a/tex/context/fonts/mkiv/type-imp-cambria.mkiv +++ b/tex/context/fonts/mkiv/type-imp-cambria.mkiv @@ -22,7 +22,12 @@ \doifunknownfontfeature {cambria-math-bold} {\definefontfeature[cambria-math-bold][boldened]} - \starttypescript [\s!math,\s!serif] [cambria,cambria-x,cambria-y] + \starttypescript [\s!math] [cambria,cambria-x,cambria-y,cambria-nt,cambria-m,cambria-a] + \checkedmapfontsize[\typescripttwo][\s!script] [.73] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.60] + \stoptypescript + + \starttypescript [\s!math,\s!serif] [cambria,cambria-x,cambria-y,cambria-nt] % whatever matches \definefontsynonym [CambriaMath] [\s!name:cambriamath] \definefontsynonym [CambriaSerif] [\s!name:cambria] @@ -47,6 +52,11 @@ \definefontsynonym [\s!MathRoman] [CambriaMath] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=cambria-math] \definefontsynonym [\s!MathRomanBold] [CambriaMath] [\s!features={\s!math\mathsizesuffix,cambria-math-bold,mathextra},\s!goodies=cambria-math] \stoptypescript + \starttypescript [\s!math] [cambria-nt] [\s!name] + \loadfontgoodies[cambria-math] + \definefontsynonym [\s!MathRoman] [CambriaMath] [\s!features={\s!math\mathsizesuffix,mathextra}] + \definefontsynonym [\s!MathRomanBold] [CambriaMath] [\s!features={\s!math\mathsizesuffix,cambria-math-bold,mathextra}] + \stoptypescript \starttypescript [\s!math] [cambria-x] [\s!name] \loadfontgoodies[cambria-math] \definefontsynonym [\s!MathRoman] [CambriaMath] [\s!features={\s!math,mathextra},\s!goodies=cambria-math] @@ -58,7 +68,7 @@ \definefontsynonym [\s!MathRomanBold] [CambriaMath] [\s!features={\s!math-nostack\mathsizesuffix,cambria-math-bold,mathextra},\s!goodies=cambria-math] \stoptypescript - \starttypescript [\s!serif] [cambria,cambria-m,cambria-a] [\s!name] + \starttypescript [\s!serif] [cambria,cambria-m,cambria-a,cambria-nt] [\s!name] \setups[\s!font:\s!fallback:\s!serif] \definefontsynonym [\s!Serif] [CambriaSerif] [\s!features=\s!default,\s!goodies=cambria] \definefontsynonym [\s!SerifBold] [\s!name:cambriabold] [\s!features=\s!default,\s!goodies=cambria] @@ -72,7 +82,7 @@ \definetypeface [cambria] [\s!tt] [\s!mono] [dejavu] [\s!default] \definetypeface [cambria] [\s!mm] [\s!math] [\typescriptone] [\s!default] \stoptypescript - \starttypescript [cambria-x,cambria-y] + \starttypescript [cambria-x,cambria-y,cambria-nt] % test x \definetypeface [\typescriptone] [\s!rm] [\s!serif] [cambria] [\s!default] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] diff --git a/tex/context/fonts/mkiv/type-imp-concrete.mkiv b/tex/context/fonts/mkiv/type-imp-concrete.mkiv index 5e4e6bc76..0ecee3e8b 100644 --- a/tex/context/fonts/mkiv/type-imp-concrete.mkiv +++ b/tex/context/fonts/mkiv/type-imp-concrete.mkiv @@ -20,7 +20,7 @@ %\definefontfeature[default-slanted-concrete][default][slant=.2] %\definefontfeature[none-slanted-concrete] [none] [slant=.2] - \starttypescript [\s!serif] [concrete-serif] + \starttypescript [\s!serif] [concrete] \definefontsynonym [\s!Serif] [\s!file:cmunorm] [\s!features=\s!default] \definefontsynonym [\s!SerifItalic] [\s!file:cmunoti] [\s!features=\s!default] \definefontsynonym [\s!SerifSlanted] [\s!file:cmunorm] [\s!features=default-slanted-concrete] @@ -29,7 +29,7 @@ \definefontsynonym [\s!SerifBoldSlanted] [\s!file:cmunobx] [\s!features=default-slanted-concrete] \stoptypescript - \starttypescript [\s!sans] [concrete-sans] + \starttypescript [\s!sans] [concrete] \definefontsynonym [\s!Sans] [\s!file:cmunss] [\s!features=\s!default] \definefontsynonym [\s!SansItalic] [\s!file:cmunsi] [\s!features=\s!default] \definefontsynonym [\s!SansSlanted] [\s!file:cmunss] [\s!features=default-slanted-concrete] @@ -38,7 +38,7 @@ \definefontsynonym [\s!SansBoldSlanted] [\s!file:cmunsx] [\s!features=default-slanted-concrete] \stoptypescript - \starttypescript [\s!mono] [concrete-mono] + \starttypescript [\s!mono] [concrete] \definefontsynonym [\s!Mono] [\s!file:cmuntt] [\s!features=\s!none] \definefontsynonym [\s!MonoItalic] [\s!file:cmunit] [\s!features=\s!none] \definefontsynonym [\s!MonoSlanted] [\s!file:cmunst] [\s!features=\s!none] @@ -47,16 +47,26 @@ \definefontsynonym [\s!MonoBoldSlanted] [\s!file:cmuntb] [\s!features=none-slanted-concrete] \stoptypescript - \starttypescript [\s!math] [concrete-math] [\s!name] + \starttypescript [\s!math] [concrete] + \checkedmapfontsize[\typescripttwo][\s!script] [.76] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.60] + \stoptypescript + + \starttypescript [\s!math] [concrete] [\s!name] \loadfontgoodies[concrete-math] \definefontsynonym[\s!MathRoman] [\s!file:Concrete-Math.otf] [\s!features={\s!math\mathsizesuffix,mathextra,concrete:mathextra},\s!goodies=concrete-math] \stoptypescript - \starttypescript [concrete] - \definetypeface [concrete] [\s!rm] [\s!serif] [concrete-serif] [\s!default] - \definetypeface [concrete] [\s!ss] [\s!sans] [concrete-sans] [\s!default] - \definetypeface [concrete] [\s!tt] [\s!mono] [concrete-mono] [\s!default] - \definetypeface [concrete] [\s!mm] [\s!math] [concrete-math] [\s!default] + \starttypescript [\s!math] [concrete-nt] [\s!name] + \loadfontgoodies[concrete-math] + \definefontsynonym[\s!MathRoman] [\s!file:Concrete-Math.otf] [\s!features={\s!math\mathsizesuffix,mathextra,concrete:mathextra}] + \stoptypescript + + \starttypescript [concrete,concrete-nt] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [concrete] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [concrete] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [concrete] [\s!default] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] \quittypescriptscanning \stoptypescript diff --git a/tex/context/fonts/mkiv/type-imp-dejavu.mkiv b/tex/context/fonts/mkiv/type-imp-dejavu.mkiv index fdd1ec5e3..d6fe406fb 100644 --- a/tex/context/fonts/mkiv/type-imp-dejavu.mkiv +++ b/tex/context/fonts/mkiv/type-imp-dejavu.mkiv @@ -16,7 +16,7 @@ \definefontfeature[dejavu-condensed-mono][extend=.8] -\starttypescriptcollection[dejavu] +\starttypescriptcollection[xxdejavu] \doifunknownfontfeature {dejavu-math-bold} {\definefontfeature[dejavu-math-bold][boldened]} @@ -44,27 +44,36 @@ \definefontsynonym [\s!MonoBoldItalic] [\s!name:dejavusansmonoboldoblique] [\s!features=\s!none,\s!fallbacks=\s!MonoBoldItalic] \stoptypescript - \starttypescript [\s!math][dejavu] [\s!name] + \starttypescript [\s!math] [dejavu,dejavu-nt,dejavu-condensed] + \checkedmapfontsize[\typescripttwo][\s!script] [.80] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.65] + \stoptypescript + + \starttypescript [\s!math] [dejavu] [\s!name] \loadfontgoodies[dejavu-math] \definefontsynonym[\s!MathRoman] [\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=dejavu-math,\s!fallbacks=\s!Math] \definefontsynonym[\s!MathRomanBold][\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,dejavu-math-bold,mathextra},\s!goodies=dejavu-math,\s!fallbacks=\s!Math] \stoptypescript - - \starttypescript[dejavu] - \definetypeface [dejavu] [\s!rm] [\s!serif] [dejavu] [\s!default] - \definetypeface [dejavu] [\s!ss] [\s!sans] [dejavu] [\s!default] - \definetypeface [dejavu] [\s!tt] [\s!mono] [dejavu] [\s!default] - % \definetypeface [dejavu] [\s!mm] [\s!math] [xits] [\s!default] [\s!rscale=1.2] - \definetypeface [dejavu] [\s!mm] [\s!math] [dejavu] [\s!default] + \starttypescript [\s!math] [dejavu-nt] [\s!name] + \loadfontgoodies[dejavu-math] + \definefontsynonym[\s!MathRoman] [\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,mathextra}] + \definefontsynonym[\s!MathRomanBold][\s!file:texgyredejavu-math][\s!features={\s!math\mathsizesuffix,dejavu-math-bold,mathextra}] \stoptypescript - \starttypescript[dejavubidi] - \definetypeface [dejavu] [\s!rm] [\s!serif] [dejavu] [\s!default] - \definetypeface [dejavu] [\s!ss] [\s!sans] [dejavu] [\s!default] - \definetypeface [dejavu] [\s!tt] [\s!mono] [dejavu] [\s!default] - \definetypeface [dejavu] [\s!mm] [\s!math] [xitsbidi] [\s!default] [\s!rscale=1.2] + \starttypescript[dejavu,dejavu-nt] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [dejavu] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [dejavu] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] \stoptypescript + % \starttypescript[dejavubidi] + % \definetypeface [dejavu] [\s!rm] [\s!serif] [dejavu] [\s!default] + % \definetypeface [dejavu] [\s!ss] [\s!sans] [dejavu] [\s!default] + % \definetypeface [dejavu] [\s!tt] [\s!mono] [dejavu] [\s!default] + % \definetypeface [dejavu] [\s!mm] [\s!math] [xitsbidi] [\s!default] [\s!rscale=1.2] + % \stoptypescript + \starttypescript [\s!serif] [dejavu-condensed] [\s!name] \setups[\s!font:\s!fallback:\s!serif] \definefontsynonym [\s!Serif] [\s!name:dejavuserifcondensed] [\s!features=\s!default] diff --git a/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv b/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv index 32c1528ad..1785eacc7 100644 --- a/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv +++ b/tex/context/fonts/mkiv/type-imp-ebgaramond.mkiv @@ -65,16 +65,24 @@ \definefontsynonym [\s!SerifCaps] [\s!Serif] [\s!features=eb-garamond-smallcaps] \stoptypescript + \starttypescript [\s!math] [ebgaramond,ebgaramond-nt] + \checkedmapfontsize[\typescripttwo][\s!script] [.70] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.50] + \stoptypescript + \starttypescript [\s!math] [ebgaramond] [\s!name] - \loadfontgoodies[garamond-math] - \definefontsynonym [\s!MathRoman] [\s!file:garamond-math.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=garamond-math] + \definefontsynonym [\s!MathRoman] [\s!file:garamond-math.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=ebgaramond-math] + \stoptypescript + + \starttypescript [\s!math] [ebgaramond-nt] [\s!name] + \definefontsynonym [\s!MathRoman] [\s!file:garamond-math.otf] [\s!features={\s!math\mathsizesuffix,mathextra}] \stoptypescript - \starttypescript[ebgaramond] - \definetypeface [ebgaramond] [\s!rm] [\s!serif] [ebgaramond] [\s!default] - \definetypeface [ebgaramond] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.8] - % \definetypeface [ebgaramond] [\s!mm] [\s!math] [bonum] [\s!default] [\s!rscale=0.8] - \definetypeface [ebgaramond] [\s!mm] [\s!math] [ebgaramond] [\s!default] + \starttypescript[ebgaramond,ebgaramond-nt] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [ebgaramond] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.8] + % \definetypeface [\typescriptone] [\s!mm] [\s!math] [bonum] [\s!default] [\s!rscale=0.8] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] \stoptypescript \stoptypescriptcollection diff --git a/tex/context/fonts/mkiv/type-imp-erewhon.mkiv b/tex/context/fonts/mkiv/type-imp-erewhon.mkiv index 8f38fb8b0..5c705400f 100644 --- a/tex/context/fonts/mkiv/type-imp-erewhon.mkiv +++ b/tex/context/fonts/mkiv/type-imp-erewhon.mkiv @@ -20,7 +20,7 @@ %\definefontfeature[default-slanted-erewhon][default][slant=.2] %\definefontfeature[none-slanted-erewhon] [none] [slant=.2] - \starttypescript [\s!serif] [erewhon-serif] + \starttypescript [\s!serif] [erewhon] \definefontsynonym [\s!Serif] [\s!file:Erewhon-Regular] [\s!features=\s!default] \definefontsynonym [\s!SerifItalic] [\s!file:Erewhon-Italic] [\s!features=\s!default] \definefontsynonym [\s!SerifSlanted] [\s!file:Erewhon-RegularSlanted][\s!features=\s!default] @@ -30,6 +30,7 @@ \stoptypescript \starttypescript [\s!sans] [cabin-sans] + \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [\s!file:Cabin-Regular] [\s!features=\s!default] \definefontsynonym [\s!SansItalic] [\s!file:Cabin-Italic] [\s!features=\s!default] \definefontsynonym [\s!SansBold] [\s!file:Cabin-SemiBold] [\s!features=\s!default] @@ -37,20 +38,29 @@ \stoptypescript \starttypescript [\s!mono] [inconsolata-mono] + \setups[\s!font:\s!fallback:\s!mono] \definefontsynonym [\s!Mono] [\s!file:Inconsolatazi4-Regular][\s!features=\s!none] \definefontsynonym [\s!MonoBold][\s!file:Inconsolatazi4-Bold] [\s!features=\s!none] \stoptypescript - \starttypescript [\s!math] [erewhon-math] [\s!name] - \loadfontgoodies[erewhon-math] - \definefontsynonym [\s!MathRoman] [\s!file:Erewhon-Math.otf] [\s!features={\s!math\mathsizesuffix,erewhon:mathextra,mathextra},\s!goodies=erewhon-math] + \starttypescript [\s!math] [erewhon,erewhon-nt] + \checkedmapfontsize[\typescripttwo][\s!script] [.70] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.55] \stoptypescript - \starttypescript [erewhon] - \definetypeface [erewhon] [\s!rm] [\s!serif] [erewhon-serif] [\s!default] - \definetypeface [erewhon] [\s!ss] [\s!sans] [cabin-sans] [\s!default] - \definetypeface [erewhon] [\s!tt] [\s!mono] [inconsolata-mono] [\s!default] [\s!rscale=1.1] - \definetypeface [erewhon] [\s!mm] [\s!math] [erewhon-math] [\s!default] + \starttypescript [\s!math] [erewhon] [\s!name] + \definefontsynonym [\s!MathRoman][\s!file:Erewhon-Math.otf][\s!features={\s!math\mathsizesuffix,erewhon:mathextra,mathextra},\s!goodies=erewhon-math] + \stoptypescript + + \starttypescript [\s!math] [erewhon-nt] [\s!name] + \definefontsynonym [\s!MathRoman][\s!file:Erewhon-Math.otf][\s!features={\s!math\mathsizesuffix,erewhon:mathextra,mathextra}] + \stoptypescript + + \starttypescript [erewhon,erewhon-nt] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [erewhon] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [cabin] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [inconsolata] [\s!default] [\s!rscale=1.1] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] \quittypescriptscanning \stoptypescript diff --git a/tex/context/fonts/mkiv/type-imp-euler.mkiv b/tex/context/fonts/mkiv/type-imp-euler.mkiv index 1aea88aae..4901c1dcb 100644 --- a/tex/context/fonts/mkiv/type-imp-euler.mkiv +++ b/tex/context/fonts/mkiv/type-imp-euler.mkiv @@ -11,6 +11,10 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% Instead of euler.otf we now use euler-math.otf which is a copy of the version +% that Daniel Flipo maintains now. We will also make an euler-regular.otf for +% text usage (which might have slighty different metrics then). + \loadtypescriptfile[texgyre] \loadtypescriptfile[dejavu] @@ -21,10 +25,10 @@ % 0x1D455 : italic h -\definefontfallback [euleroverpagella] [\s!file:euler.otf] [0x02100-0x02BFF] [\s!check=yes,\c!force=yes] -\definefontfallback [euleroverpagella] [\s!file:euler.otf] [0x1D400-0x1D7FF] [\s!check=yes,\c!force=yes] -\definefontfallback [euleroverpagella] [texgyrepagella-math] [0x0210E] [\s!check=yes,\c!force=\v!yes] -%definefontfallback [euleroverpagella] [\s!file:euler.otf] [0x1D538-0x1D550] [\s!check=yes,\c!force=yes] +\definefontfallback [euleroverpagella] [\s!file:euler-math.otf] [0x02100-0x02BFF] [\s!check=yes,\c!force=yes] +\definefontfallback [euleroverpagella] [\s!file:euler-math.otf] [0x1D400-0x1D7FF] [\s!check=yes,\c!force=yes] +\definefontfallback [euleroverpagella] [texgyrepagella-math] [0x0210E] [\s!check=yes,\c!force=\v!yes] +%definefontfallback [euleroverpagella] [\s!file:euler-math.otf] [0x1D538-0x1D550] [\s!check=yes,\c!force=yes] \definefontfallback [pagellaovereuler] [texgyrepagella-math] [0x02100-0x02BFF] [\s!check=yes] \definefontfallback [pagellaovereuler] [texgyrepagella-math] [0x1D400-0x1D7FF] [\s!check=yes] @@ -43,12 +47,12 @@ \starttypescript [\s!serif] [eulernova] [\s!name] \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym [\s!Serif] [\s!file:euler.otf] [\s!features=\s!default] + \definefontsynonym [\s!Serif] [\s!file:euler-math.otf] [\s!features=\s!default] \stoptypescript \starttypescript [\s!math] [eulernova] [\s!name] % \loadfontgoodies[euler-math] - \definefontsynonym [MathRoman] [\s!file:euler.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=euler-math] + \definefontsynonym [MathRoman] [\s!file:euler-math.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=euler-math] \stoptypescript \starttypescript [pagella-eulernova] @@ -70,7 +74,7 @@ \stoptypescript \starttypescript [\s!math] [pagellaovereuler] [\s!name] - \definefontsynonym [MathRoman] [\s!file:euler.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!fallbacks=pagellaovereuler,\s!goodies=euler-with-pagella-math] + \definefontsynonym [MathRoman] [\s!file:euler-math.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!fallbacks=pagellaovereuler,\s!goodies=euler-with-pagella-math] \stoptypescript \starttypescript [pagella-with-euler] diff --git a/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv b/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv index 77a7a0bb2..7f819fe3c 100644 --- a/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv +++ b/tex/context/fonts/mkiv/type-imp-kpfonts.mkiv @@ -15,20 +15,20 @@ \starttypescriptcollection[kpfonts-opentype] - \doifunknownfontfeature {kp-sans-bold} {\definefontfeature[kp-sans-bold][boldened]} + \doifunknownfontfeature {kp-sans-bold} {\definefontfeature[kp-sans-bold][boldened-15]} - \starttypescript [kpfonts,kpfonts-light,kpfonts-bold,kpfonts-sans] + \starttypescript [kpfonts,kpfonts-light,kpfonts-bold,kpfonts-sans,kpfonts-nt] \loadfontgoodies[kpfonts-math] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] [\s!features=\s!default] - \definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default] [\s!features=\s!default] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [\typescriptone] [\s!default] [\s!features=\s!none] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] [\s!features=\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default] [\s!features=\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [\typescriptone] [\s!default] [\s!features=\s!none] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] % for the moment here: % \setupmathrendering[\typescriptone][\s!it=\s!italic] \quittypescriptscanning \stoptypescript - \starttypescript [\s!serif] [kpfonts,kpfonts-sans] + \starttypescript [\s!serif] [kpfonts,kpfonts-sans,kpfonts-nt] \definefontsynonym [\s!Serif] [\s!file:KpRoman-Regular.otf] \definefontsynonym [\s!SerifBold] [\s!file:KpRoman-SemiBold.otf] \definefontsynonym [\s!SerifItalic] [\s!file:KpRoman-Italic.otf] @@ -52,35 +52,39 @@ \definefontsynonym [\s!SerifBold] [\s!file:KpRoman-Bold.otf] \definefontsynonym [\s!SerifItalic] [\s!file:KpRoman-Italic.otf] \definefontsynonym [\s!SerifBoldItalic] [\s!file:KpRoman-BoldItalic.otf] - % \definefontsynonym [\s!SerifSlanted] [\s!SerifItalic] - % \definefontsynonym [\s!SerifBoldSlanted] [\s!SerifBoldItalic] \stoptypescript - \starttypescript [\s!sans] [kpfonts,kpfonts-sans,kpfonts-light,kpfonts-bold] + \starttypescript [\s!sans] [kpfonts,kpfonts-sans,kpfonts-light,kpfonts-bold,kpfonts-nt] \setups[\s!font:\s!fallback:\s!sans] \definefontsynonym [\s!Sans] [\s!file:KpSans-Regular.otf] \definefontsynonym [\s!SansBold] [\s!file:KpSans-Bold.otf] \definefontsynonym [\s!SansItalic] [\s!file:KpSans-Italic.otf] \definefontsynonym [\s!SansBoldItalic] [\s!file:KpSans-BoldItalic.otf] - % \definefontsynonym [\s!SansSlanted] [\s!SansItalic] - % \definefontsynonym [\s!SansBoldSlanted] [\s!SansBoldItalic] \stoptypescript - \starttypescript [\s!mono] [kpfonts,kpfonts-sans,kpfonts-light,kpfonts-bold] + \starttypescript [\s!mono] [kpfonts,kpfonts-sans,kpfonts-light,kpfonts-bold,kpfonts-nt] \setups[\s!font:\s!fallback:\s!mono] \definefontsynonym [\s!Mono] [\s!file:KpMono-Regular.otf] \definefontsynonym [\s!MonoBold] [\s!file:KpMono-Bold.otf] \definefontsynonym [\s!MonoItalic] [\s!file:KpMono-Italic.otf] \definefontsynonym [\s!MonoBoldItalic] [\s!file:KpMono-BoldItalic.otf] - % \definefontsynonym [\s!MonoSlanted] [\s!MonoItalic] - % \definefontsynonym [\s!MonoBoldSlanted] [\s!MonoBoldItalic] \stoptypescript - \starttypescript [\s!math] [kpfonts,kpfonts-bold] + \starttypescript [\s!math] [kpfonts,kpfonts-nt,kpfonts-bold,kpfonts-light,kpfonts-sans] + \checkedmapfontsize[\typescripttwo][\s!script] [.70] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.55] + \stoptypescript + + \starttypescript [\s!math] [kpfonts] \definefontsynonym [\s!MathRoman] [\s!file:KpMath-Regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=kpfonts-math] \definefontsynonym [\s!MathRomanBold] [\s!file:KpMath-Semibold.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=kpfonts-math] \stoptypescript + \starttypescript [\s!math] [kpfonts-nt] + \definefontsynonym [\s!MathRoman] [\s!file:KpMath-Regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra}] + \definefontsynonym [\s!MathRomanBold] [\s!file:KpMath-Semibold.otf] [\s!features={\s!math\mathsizesuffix,mathextra}] + \stoptypescript + \starttypescript [\s!math] [kpfonts-bold] \definefontsynonym [\s!MathRoman] [\s!file:KpMath-Regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=kpfonts-math] \definefontsynonym [\s!MathRomanBold] [\s!file:KpMath-Bold.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=kpfonts-math] @@ -93,7 +97,7 @@ \starttypescript [\s!math] [kpfonts-sans] \definefontsynonym [\s!MathRoman] [\s!file:KpMath-Sans.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=kpfonts-math] - \definefontsynonym [\s!MathRomanBold] [\s!file:KpMath-Sans.otf] [\s!features={\s!math\mathsizesuffix,lm-math-bold,mathextra},\s!goodies=kpfonts-math] + \definefontsynonym [\s!MathRomanBold] [\s!file:KpMath-Sans.otf] [\s!features={\s!math\mathsizesuffix,kp-sans-bold,mathextra},\s!goodies=kpfonts-math] \stoptypescript \stoptypescriptcollection diff --git a/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv b/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv index e8e8e353b..f5082f784 100644 --- a/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv +++ b/tex/context/fonts/mkiv/type-imp-latinmodern.mkiv @@ -71,7 +71,7 @@ \definefontsynonym [MonoVariable] [LMTypewriterVarWd-Regular] [\s!features=\s!none] \stoptypescript - \starttypescript [\s!math] [modern,latin-modern-designsize,latin-modern] [\s!name] + \starttypescript [\s!math] [modern,latin-modern-designsize,latin-modern,modern-nt] [\s!name] \loadfontgoodies[lm] \definefontsynonym [\s!MathRoman] [LMMathRoman-Regular] \definefontsynonym [\s!MathRomanBold] [LMMathRoman-Bold] @@ -173,16 +173,23 @@ \definefontsynonym [LMTypewriterVarWd-DarkOblique] [\s!file:lmmonoproplt10-boldoblique] [\s!features=\s!default] \stoptypescript -% \starttypescript [\s!math] [modern,latin-modern] -% \loadfontgoodies[lm] -% \definefontsynonym [LMMathRoman-Regular] [\v!file:latinmodern-math-regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=lm] -% \definefontsynonym [LMMathRoman-Bold] [\v!file:latinmodern-math-regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=lm] -% \stoptypescript + \starttypescript [\s!math] [modern,modern-nt,latin-modern,modern-designsize,modern-base,% + modernvariable,modern-variable,% + modernvariablelight,modern-variable-light,% + modern-mono,modern-base-mono] + \checkedmapfontsize[\typescripttwo][\s!script] [.70] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.50] + \stoptypescript \starttypescript [\s!math] [modern,latin-modern] \loadfontgoodies[lm] - \definefontsynonym [LMMathRoman-Regular] [\v!file:latinmodern-math-regular.otf] [\s!features={\s!math\mathsizesuffix,lm:mathextra,lm-math,mathextra},\s!goodies=lm] - \definefontsynonym [LMMathRoman-Bold] [\v!file:latinmodern-math-regular.otf] [\s!features={\s!math\mathsizesuffix,lm:mathextra,lm-math-bold,lm-math,mathextra},\s!goodies=lm] + \definefontsynonym [LMMathRoman-Regular] [\v!file:latinmodern-math.otf] [\s!features={\s!math\mathsizesuffix,lm:mathextra,lm-math,mathextra},\s!goodies=modern-math] + \definefontsynonym [LMMathRoman-Bold] [\v!file:latinmodern-math.otf] [\s!features={\s!math\mathsizesuffix,lm:mathextra,lm-math-bold,lm-math,mathextra},\s!goodies=modern-math] + \stoptypescript + \starttypescript [\s!math] [modern-nt] + \loadfontgoodies[lm] + \definefontsynonym [LMMathRoman-Regular] [\v!file:latinmodern-math.otf] [\s!features={\s!math\mathsizesuffix,lm:mathextra,lm-math,mathextra}] + \definefontsynonym [LMMathRoman-Bold] [\v!file:latinmodern-math.otf] [\s!features={\s!math\mathsizesuffix,lm:mathextra,lm-math-bold,lm-math,mathextra}] \stoptypescript \starttypescript [modern-designsize-virtual] @@ -209,6 +216,14 @@ \quittypescriptscanning \stoptypescript + \starttypescript [modern-nt] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [modern-nt] [\s!default] + \quittypescriptscanning + \stoptypescript + \starttypescript [modernvariable,modern-variable] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [modern-variable] [\s!default] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern-variable] [\s!default] diff --git a/tex/context/fonts/mkiv/type-imp-libertinus.mkiv b/tex/context/fonts/mkiv/type-imp-libertinus.mkiv index 38804cf79..6e084c14e 100644 --- a/tex/context/fonts/mkiv/type-imp-libertinus.mkiv +++ b/tex/context/fonts/mkiv/type-imp-libertinus.mkiv @@ -71,17 +71,28 @@ \definefontsynonym [\s!Mono] [LibertinusMono-Regular] [\s!features=\s!none] \stoptypescript + \starttypescript [\s!math] [libertinus,libertinus-nt] + \checkedmapfontsize[\typescripttwo][\s!script] [.80] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.60] + \stoptypescript + \starttypescript [\s!math] [libertinus] [\s!name] \loadfontgoodies[libertinus-math] \definefontsynonym[\s!MathRoman ] [\s!file:libertinusmath-regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=libertinus-math.lfg] \definefontsynonym[\s!MathRomanBold] [\s!file:libertinusmath-regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=libertinus-math.lfg] \stoptypescript - \starttypescript [libertinus] - \definetypeface [libertinus] [\s!rm] [\s!serif] [libertinus] [\s!default] - \definetypeface [libertinus] [\s!ss] [\s!sans] [libertinus] [\s!default] - \definetypeface [libertinus] [\s!tt] [\s!mono] [libertinus] [\s!default] - \definetypeface [libertinus] [\s!mm] [\s!math] [libertinus] [\s!default] + \starttypescript [\s!math] [libertinus-nt] [\s!name] + \loadfontgoodies[libertinus-math] + \definefontsynonym[\s!MathRoman ] [\s!file:libertinusmath-regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra}] + \definefontsynonym[\s!MathRomanBold] [\s!file:libertinusmath-regular.otf] [\s!features={\s!math\mathsizesuffix,mathextra}] + \stoptypescript + + \starttypescript [libertinus,libertinus-nt] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [libertinus] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [libertinus] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [libertinus] [\s!default] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] \quittypescriptscanning \stoptypescript diff --git a/tex/context/fonts/mkiv/type-imp-lucida-opentype.mkiv b/tex/context/fonts/mkiv/type-imp-lucida.mkiv index 7237f7d08..ced61dcd2 100644 --- a/tex/context/fonts/mkiv/type-imp-lucida-opentype.mkiv +++ b/tex/context/fonts/mkiv/type-imp-lucida.mkiv @@ -21,7 +21,7 @@ \starttypescriptcollection[lucida-opentype] - \starttypescript [lucida,lucidaot,lucidadk] + \starttypescript [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt] \loadfontgoodies[lucida-opentype-math] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] [\s!features=\s!default] \definetypeface [\typescriptone] [\s!ss] [\s!sans] [\typescriptone] [\s!default] [\s!features=\s!default] @@ -29,11 +29,10 @@ \definetypeface [\typescriptone] [\s!hw] [\s!handwriting] [\typescriptone] [\s!default] [\s!features=\s!default] \definetypeface [\typescriptone] [\s!cg] [\s!calligraphy] [\typescriptone] [\s!default] [\s!features=\s!default] \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] - % no longer: \setupmathrendering[\typescriptone][\s!it=\s!italic] \quittypescriptscanning \stoptypescript - \starttypescript [\s!serif] [lucida,lucidaot,lucidadk] + \starttypescript [\s!serif] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt] \definefontsynonym [\s!Serif] [\s!file:LucidaBrightOT.otf] \definefontsynonym [\s!SerifBold] [\s!file:LucidaBrightOT-Demi.otf] \definefontsynonym [\s!SerifItalic] [\s!file:LucidaBrightOT-Italic.otf] @@ -42,7 +41,7 @@ \definefontsynonym [\s!SerifBoldSlanted] [\s!SerifBoldItalic] \stoptypescript - \starttypescript [\s!sans] [lucida,lucidaot,lucidadk] + \starttypescript [\s!sans] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt] \definefontsynonym [\s!Sans] [\s!file:LucidaSansOT.otf] \definefontsynonym [\s!SansBold] [\s!file:LucidaSansOT-Demi.otf] \definefontsynonym [\s!SansItalic] [\s!file:LucidaSansOT-Italic.otf] @@ -51,7 +50,7 @@ \definefontsynonym [\s!SansBoldSlanted] [\s!SansBoldItalic] \stoptypescript - \starttypescript [\s!mono] [lucida,lucidaot] + \starttypescript [\s!mono] [lucida,lucidaot,lucidaot-nt,lucida-nt] \definefontsynonym [\s!Mono] [\s!file:LucidaSansTypewriterOT.otf] \definefontsynonym [\s!MonoBold] [\s!file:LucidaSansTypewriterOT-Bold.otf] \definefontsynonym [\s!MonoItalic] [\s!file:LucidaSansTypewriterOT-Oblique.otf] @@ -60,7 +59,7 @@ \definefontsynonym [\s!MonoBoldSlanted] [\s!MonoBoldItalic] \stoptypescript - \starttypescript [\s!mono] [lucidadk] + \starttypescript [\s!mono] [lucidadk,lucidaot-nt,lucida-nt] \definefontsynonym [\s!Mono] [\s!file:LucidaGrandeMonoDK.otf] \definefontsynonym [\s!MonoBold] [\s!file:LucidaGrandeMonoDK-Bold.otf] \definefontsynonym [\s!MonoItalic] [\s!file:LucidaGrandeMonoDK-Oblique.otf] @@ -69,16 +68,26 @@ \definefontsynonym [\s!MonoBoldSlanted] [\s!MonoBoldItalic] \stoptypescript + \starttypescript [\s!math] [lucida,lucida-nt,lucidaot,lucidaot-nt,lucidadk] + \checkedmapfontsize[\typescripttwo][\s!script] [.70] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.50] + \stoptypescript + \starttypescript [\s!math] [lucida,lucidaot,lucidadk] - \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra},\s!goodies=lucida-opentype-math] - \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra},\s!goodies=lucida-opentype-math] + \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra},\s!goodies=lucida-math] + \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra},\s!goodies=lucida-math] + \stoptypescript + + \starttypescript [\s!math] [lucidaot-nt,lucida-nt] + \definefontsynonym [\s!MathRoman] [\s!file:LucidaBrightMathOT.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra}] + \definefontsynonym [\s!MathRomanBold] [\s!file:LucidaBrightMathOT-Demi.otf] [\s!features={\s!math\mathsizesuffix,mathlucida,mathextra}] \stoptypescript - \starttypescript [\s!handwriting] [lucida,lucidaot,lucidadk] + \starttypescript [\s!handwriting] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt] \definefontsynonym [\s!Handwriting] [\s!file:LucidaHandwritingOT.otf] \stoptypescript - \starttypescript [\s!calligraphy] [lucida,lucidaot,lucidadk] + \starttypescript [\s!calligraphy] [lucida,lucidaot,lucidadk,lucidaot-nt,lucida-nt] \definefontsynonym [\s!Calligraphy] [\s!file:LucidaCalligraphyOT.otf] \stoptypescript diff --git a/tex/context/fonts/mkiv/type-imp-stix.mkiv b/tex/context/fonts/mkiv/type-imp-stix.mkiv index ed2b63909..503566318 100644 --- a/tex/context/fonts/mkiv/type-imp-stix.mkiv +++ b/tex/context/fonts/mkiv/type-imp-stix.mkiv @@ -13,19 +13,23 @@ %D We provide typescripts for version one and two of the stix fonts. There is a %D xits variant based on the first (not opentype) release that also provides -%D bidirectional math. +%D bidirectional math. With (in 2022) stixtwo being frozsen for 2 years we can make +%D these the default now. %D %D Users should be aware of the fact that the stix filenames keep changing so if %D something fails, make sure you have the files and that the names below match -%D those on your system. (In \TEX\ distributions there's 2 and Two and math can have -%D -Regular appended or not. +%D those on your system. In \TEX\ distributions there's 2 and Two and math can have +%D -Regular appended or not. You can expect the \CONTEXT\ distribution to be kept up +%D to date. %D -%D There's now also: -%D -%D stixtwotext-medium.otf -%D stixtwotext-mediumitalic.otf -%D stixtwotext-semibold.otf -%D stixtwotext-semibolditalic.otf +%D Per november 2022 we swithched from \OPENTYPE\ (otf) files to \TRUETYPE\ (ttf) +%D files. The main reason is that the metrics are cleaner, especially when one peeks +%D into the font for the purpose tweaking math (boundingbox, true positioning +%D unaffected by excessive hinting shown in in FontForge). It is yet unclear to us +%D (MS & HH) why there is this difference, but it might relate to the toolchain used +%D for generating these fonts. We might even switch to (smaller) unhinted \TRUETYPE\ +%D fonts at some point but then we need to generate them ourselves). Anyway, the end +%D results are the same but we just want to be able to view it right. \definefontfeature [stixtwomath] @@ -35,23 +39,41 @@ \starttypescriptcollection[stix] + \doifunknownfontfeature {stixtwo-math-bold} {\definefontfeature[stixtwo-math-bold][boldened]} + + \starttypescript [\s!math] [stix,stixtwo,stix-nt,stixtwo-nt,xits] + \checkedmapfontsize[\typescripttwo][\s!script] [.70] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.55] + \stoptypescript + \starttypescript [\s!math] [stix,stixtwo,xits] [\s!name] - \definefontsynonym[\s!MathRoman][\s!file:stixtwomath-regular.otf][\s!features={\s!math\mathsizesuffix,stixtwomath,mathextra},\s!goodies=stix-two-math] + \definefontsynonym[\s!MathRoman] [\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwomath,stixtwo:mathextra,mathextra},\s!goodies=stixtwo-math] + \definefontsynonym[\s!MathRomanBold][\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwo-math-bold,stixtwomath,stixtwo:mathextra,mathextra},\s!goodies=stixtwo-math] + \stoptypescript + + \starttypescript [\s!math] [stix-nt,stixtwo-nt] [\s!name] + \definefontsynonym[\s!MathRoman][\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwomath,stixtwo:mathextra,mathextra}] + \definefontsynonym[\s!MathRoman][\s!file:stixtwomath-regular.ttf][\s!features={\s!math\mathsizesuffix,stixtwo-math-bold,stixtwomath,stixtwo:mathextra,mathextra}] \stoptypescript \starttypescript [\s!serif] [stix,stixtwo,xits] [\s!name] \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym[\s!Serif] [\s!file:stixtwotext-regular.otf] [\s!features=\s!default] - \definefontsynonym[\s!SerifBold] [\s!file:stixtwotext-bold.otf] [\s!features=\s!default] - \definefontsynonym[\s!SerifItalic] [\s!file:stixtwotext-italic.otf] [\s!features=\s!default] - \definefontsynonym[\s!SerifBoldItalic][\s!file:stixtwotext-bolditalic.otf][\s!features=\s!default] + \definefontsynonym[\s!Serif] [\s!file:stixtwotext-regular.ttf] [\s!features=\s!default] + \definefontsynonym[\s!SerifBold] [\s!file:stixtwotext-bold.ttf] [\s!features=\s!default] + \definefontsynonym[\s!SerifItalic] [\s!file:stixtwotext-italic.ttf] [\s!features=\s!default] + \definefontsynonym[\s!SerifBoldItalic][\s!file:stixtwotext-bolditalic.ttf][\s!features=\s!default] \stoptypescript + \starttypescript[stix,stixtwo,xits,stix-nt,stixtwo-nt] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [stixtwo] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!serif] [stixtwo] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.895] + \stoptypescript \starttypescript[stix,stixtwo,xits] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [stixtwo] [\s!default] - \definetypeface [\typescriptone] [\s!ss] [\s!serif] [stixtwo] [\s!default] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.895] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [stixtwo] [\s!default] [\s!direction=\s!both] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [stixtwo] [\s!default] [\s!direction=\s!both] + \stoptypescript + \starttypescript[stix-nt,stixtwo-nt] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [stixtwo-nt] [\s!default] [\s!direction=\s!both] \stoptypescript \stoptypescriptcollection diff --git a/tex/context/fonts/mkiv/type-imp-texgyre.mkiv b/tex/context/fonts/mkiv/type-imp-texgyre.mkiv index c6b0ab28b..87009f11e 100644 --- a/tex/context/fonts/mkiv/type-imp-texgyre.mkiv +++ b/tex/context/fonts/mkiv/type-imp-texgyre.mkiv @@ -1,4 +1,4 @@ -%D \module + %D \module %D [ file=type-imp-texgyre, %D version=2007.07.30, %D title=\CONTEXT\ Typescript Macros, @@ -163,37 +163,61 @@ % caps: \definetypeface [pagella] [rm] [serif] [pagella-caps] [default] - \starttypescript [times,termes] + \starttypescript [termes,termes-nt,times] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] \definetypeface [\typescriptone] [\s!ss] [\s!sans] [helvetica] [\s!default] [\s!rscale=0.9] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.05] + \stoptypescript + \starttypescript [termes,times] \definetypeface [\typescriptone] [\s!mm] [\s!math] [termes] [\s!default] \quittypescriptscanning \stoptypescript + \starttypescript [termes-nt] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [termes-nt] [\s!default] + \quittypescriptscanning + \stoptypescript - \starttypescript [palatino,pagella] + \starttypescript [pagella,pagella-nt,palatino] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.075] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.075] + \stoptypescript + \starttypescript [pagella,palatino] \definetypeface [\typescriptone] [\s!mm] [\s!math] [pagella] [\s!default] \quittypescriptscanning \stoptypescript + \starttypescript [pagella-nt] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [pagella-nt] [\s!default] + \quittypescriptscanning + \stoptypescript - \starttypescript [schoolbook,schola] + \starttypescript [schola,schola-nt,schoolbook] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.1] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.1] + \stoptypescript + \starttypescript [schola,schoolbook] \definetypeface [\typescriptone] [\s!mm] [\s!math] [schola] [\s!default] \quittypescriptscanning \stoptypescript + \starttypescript [schola-nt] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [schola-nt] [\s!default] + \quittypescriptscanning + \stoptypescript - \starttypescript [bookman,bonum] + \starttypescript [bonum,bonum-nt,bookman] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] \definetypeface [\typescriptone] [\s!ss] [\s!sans] [modern] [\s!default] [\s!rscale=1.1] \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] [\s!rscale=1.1] + \stoptypescript + \starttypescript [bookman,bonum] \definetypeface [\typescriptone] [\s!mm] [\s!math] [bonum] [\s!default] \quittypescriptscanning \stoptypescript + \starttypescript [bonum-nt] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [bonum-nt] [\s!default] + \quittypescriptscanning + \stoptypescript \starttypescript [chancery,chorus] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [\typescriptone] [\s!default] @@ -240,9 +264,9 @@ \startmode[txmath] - \starttypescriptcollection[texgyre-math-times] + \starttypescriptcollection[texgyre-math-termes] - \starttypescript [\s!math][times,termes][\s!all] + \starttypescript [\s!math][termes,times][\s!all] \loadfontgoodies[tx-math] \definefontsynonym[\s!MathRoman][txmath@tx-math] % \definefontsynonym[\s!MathRomanBold][MathRoman] @@ -254,14 +278,20 @@ \startnotmode[txmath] - \starttypescriptcollection[texgyre-math-times] + \starttypescriptcollection[texgyre-math-termes] - \starttypescript [\s!math][times,termes][\s!all] - % \loadfontgoodies[texgyre] - % \definefontsynonym[\s!MathRoman][file:texgyre-termes-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] + \starttypescript [\s!math][termes,termes-nt,times][\s!all] + \checkedmapfontsize[\typescripttwo][\s!script] [.74] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.55] + \stoptypescript + \starttypescript [\s!math][termes,times][\s!all] \definefontsynonym[\s!MathRoman] [file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes:mathextra,mathextra},\s!goodies=termes-math] \definefontsynonym[\s!MathRomanBold][file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes:mathextra,termes-math-bold,mathextra},\s!goodies=termes-math] \stoptypescript + \starttypescript [\s!math][termes-nt][\s!all] + \definefontsynonym[\s!MathRoman] [file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes:mathextra,mathextra}] + \definefontsynonym[\s!MathRomanBold][file:texgyretermes-math.otf][\s!features={\s!math\mathsizesuffix,termes:mathextra,termes-math-bold,mathextra}] + \stoptypescript \stoptypescriptcollection @@ -285,12 +315,18 @@ \starttypescriptcollection[texgyre-math-pagella] - \starttypescript [\s!math][palatino,pagella][\s!all] - % \loadfontgoodies[texgyre] - % \definefontsynonym[\s!MathRoman][file:texgyre-pagella-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] + \starttypescript [\s!math][pagella,pagella-nt,palatino]% [\s!all] + \checkedmapfontsize[\typescripttwo][\s!script] [.74] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.55] + \stoptypescript + \starttypescript [\s!math][pagella,palatino][\s!all] \definefontsynonym[\s!MathRoman] [file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella:mathextra,mathextra},\s!goodies=pagella-math] \definefontsynonym[\s!MathRomanBold][file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella:mathextra,pagella-math-bold,mathextra},\s!goodies=pagella-math] \stoptypescript + \starttypescript [\s!math][pagella-nt][\s!all] + \definefontsynonym[\s!MathRoman] [file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella:mathextra,mathextra}] + \definefontsynonym[\s!MathRomanBold][file:texgyrepagella-math.otf][\s!features={\s!math\mathsizesuffix,pagella:mathextra,pagella-math-bold,mathextra}] + \stoptypescript \stoptypescriptcollection @@ -298,22 +334,34 @@ \starttypescriptcollection[texgyre-math-bonum] - \starttypescript [\s!math][bookman,bonum][\s!all] - % \loadfontgoodies[texgyre] - % \definefontsynonym[\s!MathRoman][file:texgyre-bonum-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] + \starttypescript [\s!math][bonum,bonum-nt,bookman][\s!all] + \checkedmapfontsize[\typescripttwo][\s!script] [.77] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.60] + \stoptypescript + \starttypescript [\s!math][bonum,bookman][\s!all] \definefontsynonym[\s!MathRoman] [file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum:mathextra,mathextra},\s!goodies=bonum-math] \definefontsynonym[\s!MathRomanBold][file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum:mathextra,bonum-math-bold,mathextra},\s!goodies=bonum-math] \stoptypescript + \starttypescript [\s!math][bonum-nt][\s!all] + \definefontsynonym[\s!MathRoman] [file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum:mathextra,mathextra}] + \definefontsynonym[\s!MathRomanBold][file:texgyrebonum-math.otf][\s!features={\s!math\mathsizesuffix,bonum:mathextra,bonum-math-bold,mathextra}] + \stoptypescript \stoptypescriptcollection \starttypescriptcollection[texgyre-math-schola] - \starttypescript [\s!math][schoolbook,schola][\s!all] - % \loadfontgoodies[texgyre] - % \definefontsynonym[\s!MathRoman][file:texgyre-schola-math-regular.otf][\s!features={\s!math\mathsizesuffix,mathextra},\s!goodies=texgyre] + \starttypescript [\s!math][schola,schola-nt,schoolbook][\s!all] + \checkedmapfontsize[\typescripttwo][\s!script] [.77] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.60] + \stoptypescript + \starttypescript [\s!math][schola,schoolbook][\s!all] \definefontsynonym[\s!MathRoman] [file:texgyreschola-math.otf][\s!features={\s!math\mathsizesuffix,schola:mathextra,mathextra},\s!goodies=schola-math] \definefontsynonym[\s!MathRomanBold][file:texgyreschola-math.otf][\s!features={\s!math\mathsizesuffix,schola:mathextra,schola-math-bold,mathextra},\s!goodies=schola-math] \stoptypescript + \starttypescript [\s!math][schola-nt][\s!all] + \definefontsynonym[\s!MathRoman] [file:texgyreschola-math.otf][\s!features={\s!math\mathsizesuffix,schola:mathextra,mathextra}] + \definefontsynonym[\s!MathRomanBold][file:texgyreschola-math.otf][\s!features={\s!math\mathsizesuffix,schola:mathextra,schola-math-bold,mathextra}] + \stoptypescript \stoptypescriptcollection diff --git a/tex/context/fonts/mkiv/type-imp-xcharter.mkiv b/tex/context/fonts/mkiv/type-imp-xcharter.mkiv new file mode 100644 index 000000000..d27f4bcba --- /dev/null +++ b/tex/context/fonts/mkiv/type-imp-xcharter.mkiv @@ -0,0 +1,63 @@ +%D \module +%D [ file=type-imp-xcharter, +%D version=2022.30.09, % a bit older +%D title=\CONTEXT\ Typescript Macros, +%D subtitle=XCharter fonts, +%D author=Mikael Sundqvist, +%D date=\currentdate, +%D copyright={\CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\starttypescriptcollection[xcharter] + + % \definefontfeature[default-slanted-xcharter][default][slant=.2] + % \definefontfeature[none-slanted-xcharter] [none] [slant=.2] + + \starttypescript [\s!serif] [xcharter] [\s!name] + \definefontsynonym [\s!Serif] [\s!file:XCharter-Roman] [\s!features=\s!default] + \definefontsynonym [\s!SerifItalic] [\s!file:XCharter-Italic] [\s!features=\s!default] + \definefontsynonym [\s!SerifSlanted] [\s!file:XCharter-Slanted] [\s!features=\s!default] + \definefontsynonym [\s!SerifBold] [\s!file:XCharter-Bold] [\s!features=\s!default] + \definefontsynonym [\s!SerifBoldItalic] [\s!file:xcharter-BoldItalic] [\s!features=\s!default] + \definefontsynonym [\s!SerifBoldSlanted][\s!file:XCharter-BoldSlanted][\s!features=\s!default] + \stoptypescript + + \starttypescript [\s!sans] [cabin] [\s!name] + \setups[\s!font:\s!fallback:\s!sans] + \definefontsynonym [\s!Sans] [\s!file:Cabin-Regular] [\s!features=\s!default] + \definefontsynonym [\s!SansItalic] [\s!file:Cabin-Italic] [\s!features=\s!default] + \definefontsynonym [\s!SansBold] [\s!file:Cabin-SemiBold] [\s!features=\s!default] + \definefontsynonym [\s!SansBoldItalic][\s!file:Cabin-SemiBoldItalic][\s!features=\s!default] + \stoptypescript + + \starttypescript [\s!mono] [inconsolata] [\s!name] + \setups[\s!font:\s!fallback:\s!mono] + \definefontsynonym [\s!Mono] [\s!file:Inconsolatazi4-Regular][\s!features=\s!none] + \definefontsynonym [\s!MonoBold][\s!file:Inconsolatazi4-Bold] [\s!features=\s!none] + \stoptypescript + + \starttypescript [\s!math] [xcharter,xcharter-nt][\s!name] + \checkedmapfontsize[\typescripttwo][\s!script] [.70] + \checkedmapfontsize[\typescripttwo][\s!scriptscript][.55] + \stoptypescript + + \starttypescript [\s!math] [xcharter][\s!name] + \definefontsynonym [\s!MathRoman][\s!file:XCharter-Math.otf][\s!features={\s!math\mathsizesuffix,xcharter:mathextra,mathextra},\s!goodies=xcharter-math] + \stoptypescript + + \starttypescript [\s!math] [xcharter-nt] [\s!name] + \definefontsynonym [\s!MathRoman][\s!file:XCharter-Math.otf][\s!features={\s!math\mathsizesuffix,xcharter:mathextra,mathextra}] + \stoptypescript + + \starttypescript [xcharter,xcharter-nt] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [xcharter] [\s!default] + \definetypeface [\typescriptone] [\s!ss] [\s!sans] [cabin] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [inconsolata] [\s!default] [\s!rscale=1.1] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [\typescriptone] [\s!default] + \quittypescriptscanning + \stoptypescript + +\stoptypescriptcollection diff --git a/tex/context/fonts/mkiv/xcharter-math.lfg b/tex/context/fonts/mkiv/xcharter-math.lfg new file mode 100644 index 000000000..c9b5a2690 --- /dev/null +++ b/tex/context/fonts/mkiv/xcharter-math.lfg @@ -0,0 +1,127 @@ +-- This font is under active development so we don't want to tweek it too much +-- before all issues are sorted out. + +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + +return { + name = "xcharter-math", + version = "1.00", + comment = "Goodies that complement xcharter math.", + author = "Hans Hagen & Mikael Sundqvist", + copyright = "ConTeXt development team", + mathematics = { + parameters = { + -- NoLimitSupFactor = 0, + -- NoLimitSubFactor = 900, + -- AccentBaseHeight = 0, + -- AccentBaseDepth = 60, + -- RadicalDegreeBottomRaisePercent = 55, + -- RadicalKernAfterDegree = -600, + -- RadicalRuleThickness = 45, -- 55 in font + -- DelimiterPercent = 90, + -- DelimiterShortfall = 400, + -- DisplayOperatorMinHeight = 1800, -- 1300 in font (one size) + }, + tweaks = { + aftercopying = { + { + tweak = "fixprimes", + factor = 0.8, + scale = 1, + }, + { + tweak = "addmirrors", + }, +{ + tweak = "dimensions", + list = { + -- ["0x222B.variants.*"] = { axis = 0.15 }, + }, +}, +{ + -- tweak = "fixintegrals", +}, + presets.scripttocalligraphic { }, + presets.rsfstoscript { }, + presets.rsfsuprighttoscript { }, + presets.moderntocalligraphic { }, + presets.eulertocalligraphic { }, + presets.xitsarabic { rscale = 0.90 }, + presets.fallbacks { }, + presets.moveitalics { correct = true }, + presets.moveitalics { correct = true, letters = true }, + presets.moveintegrals { factor = 1.5 }, + presets.wipeitalics { }, + { + tweak = "kerns", + list = { + [0x002F] = { topleft = -0.15, bottomright = -0.15 }, + ["0x7D.parts.top"] = { topright = -0.15, }, -- right brace top + ["0x7D.parts.bottom"] = { bottomright = -0.15 }, -- right brace bottom + ["0x7D.variants.*"] = { topright = -0.05, bottomright = -0.05 }, -- right brace variants + ["0x29.parts.top"] = { topright = -0.1, }, -- right parenthesis top + ["0x29.parts.bottom"] = { bottomright = -0.1 }, -- right parenthesis bottom + ["0x29.variants.*"] = { topright = -0.1, bottomright = -0.1 }, -- right parenthesis variants + ["0x221A.parts.top"] = { topright = 0.2, }, -- right radical top + ["0x221A.parts.bottom"] = { bottomright = 0.2 }, -- right radical bottom + ["0x221A.variants.*"] = { topright = 0.2, bottomright = 0.2 }, -- right radical variants + [0x27E9] = { topright = -0.1, bottomright = -0.1 }, -- angle + ["0x27E9.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + [0x27EB] = { topright = -0.1, bottomright = -0.1 }, + ["0x27EB.variants.*"] = { topright = -0.2, bottomright = -0.2 }, + }, + }, +{ + tweak = "radicaldegreeanchors", + list = { + -- [0x221A] = { location = "left", hfactor = .1, vfactor = .3 }, + -- ["0x221A.variants.*"] = { location = "left", hfactor = .1, vfactor = .625 }, + -- ["0x221A.variants.1"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.2"] = { location = "left", hfactor = .1, vfactor = .575 }, + -- ["0x221A.variants.3"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.4"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.variants.5"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221Aq.variants.6"] = { location = "left", hfactor = .1, vfactor = .55 }, + -- ["0x221A.parts.top"] = { location = "left", hfactor = .1, vfactor = 5.5 }, -- keep commented: bottom wins over top + ["0x221A.parts.bottom"] = { location = "left", hfactor = .1, vfactor = 1.025 }, + } +}, + + { + tweak = "checkspacing", + }, + { + tweak = "addscripts", + }, + { + tweak = "accentdimensions", + }, + { + tweak = "addrules", + }, + { + tweak = "addactuarian", + }, + { + tweak = "addequals", + }, + { + tweak = "setoptions", + -- set = { "ignorekerndimensions" } + }, + -- this is the mkiv section +-- { +-- tweak = "emulatelmtx", +-- feature = "emulatelmtx", +-- comment = "this is for mkiv", +-- }, + }, + }, + bigslots = { + 1, 2, 3, 4 + }, + }, + +} diff --git a/tex/context/fonts/mkiv/xits-math.lfg b/tex/context/fonts/mkiv/xits-math.lfg index 9eb1a1200..1d7e22df6 100644 --- a/tex/context/fonts/mkiv/xits-math.lfg +++ b/tex/context/fonts/mkiv/xits-math.lfg @@ -2,6 +2,9 @@ -- -- \definefilesynonym [type-imp-xits.mkiv] [type-imp-xits.mkiv] +local common = fonts.goodies.load("common-math.lfg") +local presets = common.mathematics.tweaks.presets + return { name = "xits-math", version = "1.00", diff --git a/tex/context/interface/mkii/keys-fr.xml b/tex/context/interface/mkii/keys-fr.xml index 96e655e31..89a549482 100644 --- a/tex/context/interface/mkii/keys-fr.xml +++ b/tex/context/interface/mkii/keys-fr.xml @@ -96,7 +96,6 @@ <cd:variable name='author' value='auteur'/> <cd:variable name='auto' value='auto'/> <cd:variable name='autointro' value='autointro'/> - <cd:variable name='autopunctuation' value='autoponctuation'/> <cd:variable name='back' value='retour'/> <cd:variable name='background' value='arriereplan'/> <cd:variable name='backmatter' value='pagesdefin'/> @@ -683,9 +682,13 @@ <cd:constant name='authoretaltext' value='auteuretaltexte'/> <cd:constant name='auto' value='auto'/> <cd:constant name='autocase' value='autocase'/> + <cd:constant name='autofencing' value='autofencing'/> <cd:constant name='autofile' value='autofichier'/> <cd:constant name='autofocus' value='autofocus'/> <cd:constant name='autohang' value='autosuspendre'/> + <cd:constant name='autonumbers' value='autonumbers'/> + <cd:constant name='autopunctuation' value='autoponctuation'/> + <cd:constant name='autospacing' value='autospacing'/> <cd:constant name='autostrut' value='autoentretoise'/> <cd:constant name='autowidth' value='autolargeur'/> <cd:constant name='availableheight' value='hauteurdisponible'/> diff --git a/tex/context/modules/mkiv/s-math-extensibles.mkiv b/tex/context/modules/mkiv/s-math-extensibles.mkiv index cc6fd1b00..b3fcf0e1f 100644 --- a/tex/context/modules/mkiv/s-math-extensibles.mkiv +++ b/tex/context/modules/mkiv/s-math-extensibles.mkiv @@ -143,3 +143,71 @@ } \stoptext + +% This could also be some tracer + +\definefontfeature[mathextra][goodies=] % or use the raw unpatched font + + +\def\Test#1% + {\left( + \scratchdimen\Umathaxis\displaystyle + \blackrule + [height=\dimexpr#1ex+\scratchdimen\relax, + depth=\dimexpr#1ex-\scratchdimen\relax] + \right)} + + +\startbuffer[p] +% \Umathconnectoroverlapmin\allmathstyles \zeropoint +% \Umathconnectoroverlapmin\allmathstyles 2pt % \zeropoint + \Umathdelimitershortfall \allmathstyles \zeropoint + \showboxes + \showglyphs + \Test{4.0} + \Test{4.5} + \Test{5.0} + \Test{8.0} + \quad + \dorecurse{\mathvariantcount `(} { + \char\mathvariantcode `( #1 + } +\stopbuffer + +\startbuffer[p] + \showboxes + \showglyphs + \overparent{\blackrule[color=darkgray,width=1em,height=2ex]}\quad + \overparent{\blackrule[color=darkgray,width=2em,height=2ex]}\quad + \overparent{\blackrule[color=darkgray,width=4em,height=2ex]}\quad + \overparent{\blackrule[color=darkgray,width=8em,height=2ex]} +\stopbuffer + +\startbuffer + \hpack\bgroup + $ + \getbuffer[p] + $ + \egroup +\stopbuffer + +\def\TestFont#1% + {\dontleavehmode + \begingroup + \hbox to 5.5em{\hss\type{#1}:}\quad + \switchtobodyfont[#1]\getbuffer + \endgroup + \par} + +\starttext + \startTEXpage[offset=1dk] +% \TestFont{modern} +% \TestFont{pagella} +% \TestFont{termes} +% \TestFont{bonum} + \TestFont{lucida} +% \TestFont{cambria} + \TestFont{ebgaramond} +% \TestFont{xits} + \stopTEXpage +\stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 480f4ef66..c249372fb 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2022-10-22 11:20 +-- merge date : 2022-11-14 22:54 do -- begin closure to overcome local limits and interference @@ -9406,19 +9406,9 @@ function constructors.scale(tfmdata,specification) target.unscaled=tfmdata local mathsize=tonumber(specification.mathsize) or 0 local textsize=tonumber(specification.textsize) or scaledpoints - local forcedsize=tonumber(parameters.mathsize ) or 0 local extrafactor=tonumber(specification.factor ) or 1 - if (mathsize==2 or forcedsize==2) and parameters.scriptpercentage then - scaledpoints=parameters.scriptpercentage*textsize/100 - elseif (mathsize==3 or forcedsize==3) and parameters.scriptscriptpercentage then - scaledpoints=parameters.scriptscriptpercentage*textsize/100 - elseif forcedsize>1000 then - scaledpoints=forcedsize - else - end targetparameters.mathsize=mathsize - targetparameters.textsize=textsize - targetparameters.forcedsize=forcedsize + targetparameters.textsize=textsize targetparameters.extrafactor=extrafactor local addtounicode=constructors.addtounicode local tounicode=fonts.mappings.tounicode @@ -15659,8 +15649,11 @@ local function applyaxis(glyph,shape,deltas,dowidth) end if found==last then lastindex=currentindex - break; + break elseif found>last then +while lastindex>1 and dpoints[lastindex]>last do + lastindex=lastindex-1 +end break end end @@ -15668,7 +15661,7 @@ local function applyaxis(glyph,shape,deltas,dowidth) local function find(i) local prv=lastindex for j=firstindex,lastindex do - local nxt=dpoints[j] + local nxt=dpoints[j] if nxt==i then return false,j,false elseif nxt>i then @@ -18602,22 +18595,18 @@ do report("used %s lookups: % t",what,sortedkeys(usedlookups)) end local reported={} - local function report_issue(i,what,sequence,kind) - local name=sequence.name - if not reported[name] then - report("rule %i in %s lookup %a has %s lookups",i,what,name,kind) - reported[name]=true - end + local function report_issue(i,what,step,kind) + report("rule %i in step %i of %s has %s lookups",i,step,what,kind) end - for i=1,#allsteps do - local step=allsteps[i] + for s=1,#allsteps do + local step=allsteps[s] local rules=step.rules if rules then for i=1,#rules do local rule=rules[i] local rlookups=rule.lookups if not rlookups then - report_issue(i,what,sequence,"no") + report_issue(i,what,s,"no") elseif not next(rlookups) then rule.lookups=nil else @@ -18653,12 +18642,12 @@ do sublookupcheck[lookupid]=1 h=nofsublookups else - report_issue(i,what,sequence,"missing") + report_issue(i,what,s,"missing") rule.lookups=nil break end else - report_issue(i,what,sequence,"bad") + report_issue(i,what,s,"bad") rule.lookups=nil break end @@ -19183,7 +19172,7 @@ local function readmathvariants(f,fontdata,offset) local vconstruction=readcardinaltable(f,vnofglyphs,ushort) local hconstruction=readcardinaltable(f,hnofglyphs,ushort) fontdata.mathconstants.MinConnectorOverlap=minoverlap - local function get(offset,coverage,nofglyphs,construction,kvariants,kparts,kitalic) + local function get(offset,coverage,nofglyphs,construction,kvariants,kparts,kitalic,korientation,orientation) if coverage~=0 and nofglyphs>0 then local coverage=readcoverage(f,offset+coverage,true) for i=1,nofglyphs do @@ -19246,13 +19235,21 @@ local function readmathvariants(f,fontdata,offset) if italic and italic~=0 then math[kitalic]=italic end + if orientation then + math[korientation]=orientation + end end end end end end - get(offset,vcoverage,vnofglyphs,vconstruction,"vvariants","vparts","vitalic") - get(offset,hcoverage,hnofglyphs,hconstruction,"hvariants","hparts","hitalic") + if CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 then + get(offset,hcoverage,hnofglyphs,hconstruction,"variants","parts","partsitalic","partsorientation","horizontal") + get(offset,vcoverage,vnofglyphs,vconstruction,"variants","parts","partsitalic","partsorientation","vertical") + else + get(offset,vcoverage,vnofglyphs,vconstruction,"vvariants","vparts","vitalic") + get(offset,hcoverage,hnofglyphs,hconstruction,"hvariants","hparts","hitalic") + end end function readers.math(f,fontdata,specification) local tableoffset=gotodatatable(f,fontdata,"math",specification.glyphs) @@ -21294,7 +21291,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_d local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.121 +otf.version=3.130 otf.cache=containers.define("fonts","otl",otf.version,true) otf.svgcache=containers.define("fonts","svg",otf.version,true) otf.pngcache=containers.define("fonts","png",otf.version,true) @@ -21777,24 +21774,6 @@ local function read_from_otf(specification) end return tfmdata end -local function checkmathsize(tfmdata,mathsize) - local mathdata=tfmdata.shared.rawdata.metadata.math - local mathsize=tonumber(mathsize) - if mathdata then - local parameters=tfmdata.parameters - parameters.scriptpercentage=mathdata.ScriptPercentScaleDown - parameters.scriptscriptpercentage=mathdata.ScriptScriptPercentScaleDown - parameters.mathsize=mathsize - end -end -registerotffeature { - name="mathsize", - description="apply mathsize specified in the font", - initializers={ - base=checkmathsize, - node=checkmathsize, - } -} function otf.collectlookups(rawdata,kind,script,language) if not kind then return @@ -24786,24 +24765,40 @@ local function unifyglyphs(fontdata,usenames) descriptions[unicode]=glyph end end - for index=1,nofglyphs do - local math=glyphs[index].math - if math then - local list=math.vparts - if list then - for i=1,#list do local l=list[i] l.glyph=indices[l.glyph] end - end - local list=math.hparts - if list then - for i=1,#list do local l=list[i] l.glyph=indices[l.glyph] end - end - local list=math.vvariants - if list then - for i=1,#list do list[i]=indices[list[i]] end + if LUATEXENGINE=="luametatex" then + for index=1,nofglyphs do + local math=glyphs[index].math + if math then + local list=math.parts + if list then + for i=1,#list do local l=list[i] l.glyph=indices[l.glyph] end + end + local list=math.variants + if list then + for i=1,#list do list[i]=indices[list[i]] end + end end - local list=math.hvariants - if list then - for i=1,#list do list[i]=indices[list[i]] end + end + else + for index=1,nofglyphs do + local math=glyphs[index].math + if math then + local list=math.vparts + if list then + for i=1,#list do local l=list[i] l.glyph=indices[l.glyph] end + end + local list=math.hparts + if list then + for i=1,#list do local l=list[i] l.glyph=indices[l.glyph] end + end + local list=math.vvariants + if list then + for i=1,#list do list[i]=indices[list[i]] end + end + local list=math.hvariants + if list then + for i=1,#list do list[i]=indices[list[i]] end + end end end end @@ -37130,7 +37125,7 @@ local afm=fonts.handlers.afm local pfb=fonts.handlers.pfb local hashes=fonts.hashes local identifiers=hashes.identifiers -local version=otf.version or 0.013 +local version=otf.version or 0.014 local shapescache=containers.define("fonts","shapes",version,true) local streamscache=containers.define("fonts","streams",version,true) local compact_streams=false |