summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/base/mpiv/metafun.mpiv1
-rw-r--r--metapost/context/base/mpiv/metafun.mpxl1
-rw-r--r--metapost/context/base/mpiv/minifun.mpiv1
-rw-r--r--metapost/context/base/mpiv/minifun.mpxl1
-rw-r--r--metapost/context/base/mpiv/mp-cont.mpiv158
-rw-r--r--metapost/context/base/mpiv/mp-cont.mpxl158
-rw-r--r--metapost/context/base/mpiv/mp-luas.mpxl9
-rw-r--r--metapost/context/base/mpiv/mp-math.mpxl226
-rw-r--r--metapost/context/base/mpiv/mp-page.mpiv142
9 files changed, 446 insertions, 251 deletions
diff --git a/metapost/context/base/mpiv/metafun.mpiv b/metapost/context/base/mpiv/metafun.mpiv
index 346642cac..f00cc260c 100644
--- a/metapost/context/base/mpiv/metafun.mpiv
+++ b/metapost/context/base/mpiv/metafun.mpiv
@@ -24,6 +24,7 @@ input "mp-base.mpiv" ;
input "mp-tool.mpiv" ;
input "mp-mlib.mpiv" ;
input "mp-luas.mpiv" ;
+input "mp-cont.mpiv" ;
input "mp-page.mpiv" ;
input "mp-butt.mpiv" ;
input "mp-shap.mpiv" ;
diff --git a/metapost/context/base/mpiv/metafun.mpxl b/metapost/context/base/mpiv/metafun.mpxl
index 93fb0ab82..edbb5bacd 100644
--- a/metapost/context/base/mpiv/metafun.mpxl
+++ b/metapost/context/base/mpiv/metafun.mpxl
@@ -22,6 +22,7 @@ input "mp-tool.mpiv" ;
input "mp-mlib.mpiv" ;
input "mp-luas.mpxl" ;
input "mp-math.mpxl" ;
+input "mp-cont.mpxl" ;
input "mp-page.mpiv" ;
input "mp-butt.mpiv" ;
input "mp-shap.mpiv" ;
diff --git a/metapost/context/base/mpiv/minifun.mpiv b/metapost/context/base/mpiv/minifun.mpiv
index 1aa496da2..e78bd8e2e 100644
--- a/metapost/context/base/mpiv/minifun.mpiv
+++ b/metapost/context/base/mpiv/minifun.mpiv
@@ -23,6 +23,7 @@ input "mp-base.mpiv" ;
input "mp-tool.mpiv" ;
input "mp-mlib.mpiv" ;
input "mp-luas.mpiv" ;
+input "mp-cont.mpiv" ;
input "mp-page.mpiv" ;
string minifunversion ; minifunversion = "minifun iv " & mfun_timestamp;
diff --git a/metapost/context/base/mpiv/minifun.mpxl b/metapost/context/base/mpiv/minifun.mpxl
index ff71bdfcc..ec5cb364c 100644
--- a/metapost/context/base/mpiv/minifun.mpxl
+++ b/metapost/context/base/mpiv/minifun.mpxl
@@ -24,6 +24,7 @@ input "mp-tool.mpiv" ;
input "mp-mlib.mpiv" ;
input "mp-luas.mpxl" ;
input "mp-math.mpxl" ;
+input "mp-cont.mpiv" ;
input "mp-page.mpiv" ;
string minifunversion ; minifunversion = "minifun xl " & mfun_timestamp;
diff --git a/metapost/context/base/mpiv/mp-cont.mpiv b/metapost/context/base/mpiv/mp-cont.mpiv
new file mode 100644
index 000000000..083286bee
--- /dev/null
+++ b/metapost/context/base/mpiv/mp-cont.mpiv
@@ -0,0 +1,158 @@
+%D \module
+%D [ file=mp-cont.mpiv,
+%D version=1999.03.10,
+%D title=\CONTEXT\ \METAPOST\ graphics,
+%D subtitle=Interfaces,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module is rather preliminary and subjected to changes.
+
+if known context_cont : endinput ; fi ;
+
+boolean context_cont ; context_cont := true ;
+
+string CurrentLayout ; CurrentLayout := "default" ;
+
+boolean mfun_swapped ;
+
+def SwapPageState =
+ mfun_swapped := true ; % eventually this will go !
+enddef ;
+
+extra_beginfig := extra_beginfig & "mfun_swapped := false ;" ;
+
+% runscript("mp.PaperHeight()") is much faster than lua.mp.PaperHeight() so we use that now:
+
+vardef PaperHeight = runscript("mp.PaperHeight()") enddef ;
+vardef PaperWidth = runscript("mp.PaperWidth()") enddef ;
+vardef PrintPaperHeight = runscript("mp.PrintPaperHeight()") enddef ;
+vardef PrintPaperWidth = runscript("mp.PrintPaperWidth()") enddef ;
+vardef TopSpace = runscript("mp.TopSpace()") enddef ;
+vardef BottomSpace = runscript("mp.BottomSpace()") enddef ;
+vardef BackSpace = runscript("mp.BackSpace()") enddef ;
+vardef CutSpace = runscript("mp.CutSpace()") enddef ;
+vardef MakeupHeight = runscript("mp.MakeupHeight()") enddef ;
+vardef MakeupWidth = runscript("mp.MakeupWidth()") enddef ;
+vardef TopHeight = runscript("mp.TopHeight()") enddef ;
+vardef TopDistance = runscript("mp.TopDistance()") enddef ;
+vardef HeaderHeight = runscript("mp.HeaderHeight()") enddef ;
+vardef HeaderDistance = runscript("mp.HeaderDistance()") enddef ;
+vardef TextHeight = runscript("mp.TextHeight()") enddef ;
+vardef FooterDistance = runscript("mp.FooterDistance()") enddef ;
+vardef FooterHeight = runscript("mp.FooterHeight()") enddef ;
+vardef BottomDistance = runscript("mp.BottomDistance()") enddef ;
+vardef BottomHeight = runscript("mp.BottomHeight()") enddef ;
+vardef LeftEdgeWidth = runscript("mp.LeftEdgeWidth()") enddef ;
+vardef LeftEdgeDistance = runscript("mp.LeftEdgeDistance()") enddef ;
+vardef LeftMarginWidth = runscript("mp.LeftMarginWidth()") enddef ;
+vardef LeftMarginDistance = runscript("mp.LeftMarginDistance()") enddef ;
+vardef TextWidth = runscript("mp.TextWidth()") enddef ;
+vardef RightMarginDistance = runscript("mp.RightMarginDistance()") enddef ;
+vardef RightMarginWidth = runscript("mp.RightMarginWidth()") enddef ;
+vardef RightEdgeDistance = runscript("mp.RightEdgeDistance()") enddef ;
+vardef RightEdgeWidth = runscript("mp.RightEdgeWidth()") enddef ;
+vardef InnerMarginDistance = runscript("mp.InnerMarginDistance()") enddef ;
+vardef InnerMarginWidth = runscript("mp.InnerMarginWidth()") enddef ;
+vardef OuterMarginDistance = runscript("mp.OuterMarginDistance()") enddef ;
+vardef OuterMarginWidth = runscript("mp.OuterMarginWidth()") enddef ;
+vardef InnerEdgeDistance = runscript("mp.InnerEdgeDistance()") enddef ;
+vardef InnerEdgeWidth = runscript("mp.InnerEdgeWidth()") enddef ;
+vardef OuterEdgeDistance = runscript("mp.OuterEdgeDistance()") enddef ;
+vardef OuterEdgeWidth = runscript("mp.OuterEdgeWidth()") enddef ;
+vardef PageOffset = runscript("mp.PageOffset()") enddef ;
+vardef PageDepth = runscript("mp.PageDepth()") enddef ;
+vardef LayoutColumns = runscript("mp.LayoutColumns()") enddef ;
+vardef LayoutColumnDistance = runscript("mp.LayoutColumnDistance()") enddef ;
+vardef LayoutColumnWidth = runscript("mp.LayoutColumnWidth()") enddef ;
+
+vardef OnRightPage = runscript("mp.OnRightPage()") enddef ;
+vardef OnOddPage = runscript("mp.OnOddPage()") enddef ;
+vardef InPageBody = runscript("mp.InPageBody()") enddef ;
+
+vardef RealPageNumber = runscript("mp.RealPageNumber()") enddef ;
+vardef LastPageNumber = runscript("mp.LastPageNumber()") enddef ; % duplicates
+
+vardef PageNumber = runscript("mp.PageNumber()") enddef ;
+vardef NOfPages = runscript("mp.NOfPages()") enddef ;
+
+vardef SubPageNumber = runscript("mp.SubPageNumber()") enddef ;
+vardef NOfSubPages = runscript("mp.NOfSubPages()") enddef ;
+
+vardef CurrentColumn = runscript("mp.CurrentColumn()") enddef ;
+vardef NOfColumns = runscript("mp.NOfColumns()") enddef ;
+
+vardef BaseLineSkip = runscript("mp.BaseLineSkip()") enddef ;
+vardef LineHeight = runscript("mp.LineHeight()") enddef ;
+vardef BodyFontSize = runscript("mp.BodyFontSize()") enddef ;
+
+vardef TopSkip = runscript("mp.TopSkip()") enddef ;
+vardef StrutHeight = runscript("mp.StrutHeight()") enddef ;
+vardef StrutDepth = runscript("mp.StrutDepth()") enddef ;
+
+vardef CurrentWidth = runscript("mp.CurrentWidth()") enddef ;
+vardef CurrentHeight = runscript("mp.CurrentHeight()") enddef ;
+
+vardef HSize = runscript("mp.HSize()") enddef ; % duplicates
+vardef VSize = runscript("mp.VSize()") enddef ; % duplicates
+
+vardef EmWidth = runscript("mp.EmWidth()") enddef ;
+vardef ExHeight = runscript("mp.ExHeight()") enddef ;
+
+vardef PageFraction = runscript("mp.PageFraction()") enddef ;
+
+vardef SpineWidth = runscript("mp.SpineWidth()") enddef ;
+vardef PaperBleed = runscript("mp.PaperBleed()") enddef ;
+
+% CurrentLayout = runscript("mp.CurrentLayout()") enddef ;
+vardef OverlayWidth = runscript("mp.OverlayWidth()") enddef ;
+vardef OverlayHeight = runscript("mp.OverlayHeight()") enddef ;
+vardef OverlayDepth = runscript("mp.OverlayDepth()") enddef ;
+vardef OverlayLineWidth = runscript("mp.OverlayLineWidth()") enddef ;
+vardef OverlayOffset = runscript("mp.OverlayOffset()") enddef ;
+vardef OverlayRegion = runscript("mp.OverlayRegion()") enddef ;
+% OverlayLineColor = runscript("mp.OverlayLineColor()") enddef ;
+% OverlayColor = runscript("mp.OverlayColor()") enddef ;
+
+vardef defaultcolormodel = runscript("mp.defaultcolormodel()") enddef ;
+
+vardef LeftMarginWidth = if mfun_swapped and not OnRightPage : runscript("mp.RightMarginWidth()") else : runscript("mp.LeftMarginWidth()") fi enddef ;
+vardef RightMarginWidth = if mfun_swapped and not OnRightPage : runscript("mp.LeftMarginWidth()") else : runscript("mp.RightMarginWidth()") fi enddef ;
+vardef LeftMarginDistance = if mfun_swapped and not OnRightPage : runscript("mp.RightMarginDistance()") else : runscript("mp.LeftMarginDistance()") fi enddef ;
+vardef RightMarginDistance = if mfun_swapped and not OnRightPage : runscript("mp.LeftMarginDistance()") else : runscript("mp.RightMarginDistance()") fi enddef ;
+
+vardef LeftEdgeWidth = if mfun_swapped and not OnRightPage : runscript("mp.RightEdgeWidth()") else : runscript("mp.LeftEdgeWidth()") fi enddef ;
+vardef RightEdgeWidth = if mfun_swapped and not OnRightPage : runscript("mp.LeftEdgeWidth()") else : runscript("mp.RightEdgeWidth()") fi enddef ;
+vardef LeftEdgeDistance = if mfun_swapped and not OnRightPage : runscript("mp.RightEdgeDistance()") else : runscript("mp.LeftEdgeDistance()") fi enddef ;
+vardef RightEdgeDistance = if mfun_swapped and not OnRightPage : runscript("mp.LeftEdgeDistance()") else : runscript("mp.RightEdgeDistance()") fi enddef ;
+
+vardef BackSpace = if mfun_swapped and not OnRightPage : PaperWidth - MakeupWidth - fi runscript("mp.BackSpace()") enddef ;
+vardef CutSpace = if mfun_swapped and not OnRightPage : PaperWidth - MakeupWidth - fi runscript("mp.CutSpace()") enddef ;
+
+% better use:
+
+vardef OuterMarginWidth = if not OnRightPage : runscript("mp.LeftMarginWidth()") else : runscript("mp.RightMarginWidth()") fi enddef ;
+vardef InnerMarginWidth = if not OnRightPage : runscript("mp.RightMarginWidth()") else : runscript("mp.LeftMarginWidth()") fi enddef ;
+vardef OuterMarginDistance = if not OnRightPage : runscript("mp.LeftMarginDistance()") else : runscript("mp.RightMarginDistance()") fi enddef ;
+vardef InnerMarginDistance = if not OnRightPage : runscript("mp.RightMarginDistance()") else : runscript("mp.LeftMarginDistance()") fi enddef ;
+
+vardef OuterEdgeWidth = if not OnRightPage : runscript("mp.LeftEdgeWidth()") else : runscript("mp.RightEdgeWidth()") fi enddef ;
+vardef InnerEdgeWidth = if not OnRightPage : runscript("mp.RightEdgeWidth()") else : runscript("mp.LeftEdgeWidth()") fi enddef ;
+vardef OuterEdgeDistance = if not OnRightPage : runscript("mp.LeftEdgeDistance()") else : runscript("mp.RightEdgeDistance()") fi enddef ;
+vardef InnerEdgeDistance = if not OnRightPage : runscript("mp.RightEdgeDistance()") else : runscript("mp.LeftEdgeDistance()") fi enddef ;
+
+vardef OuterSpaceWidth = if not OnRightPage : runscript("mp.BackSpace()") else : runscript("mp.CutSpace()") fi enddef ;
+vardef InnerSpaceWidth = if not OnRightPage : runscript("mp.CutSpace()") else : runscript("mp.BackSpace()") fi enddef ;
+
+% indices
+
+vardef OuterMargin = if not OnRightPage : LeftMargin else : RightMargin fi enddef ;
+vardef InnerMargin = if not OnRightPage : RightMargin else : LeftMargin fi enddef ;
+
+vardef OuterEdge = if not OnRightPage : LeftEdge else : RightEdge fi enddef ;
+vardef InnerEdge = if not OnRightPage : Rightedge else : LeftEdge fi enddef ;
diff --git a/metapost/context/base/mpiv/mp-cont.mpxl b/metapost/context/base/mpiv/mp-cont.mpxl
new file mode 100644
index 000000000..bc318d4b9
--- /dev/null
+++ b/metapost/context/base/mpiv/mp-cont.mpxl
@@ -0,0 +1,158 @@
+%D \module
+%D [ file=mp-cont.mpiv,
+%D version=1999.03.10,
+%D title=\CONTEXT\ \METAPOST\ graphics,
+%D subtitle=Interfaces,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+%D This module is rather preliminary and subjected to changes.
+
+if known context_cont : endinput ; fi ;
+
+boolean context_cont ; context_cont := true ;
+
+string CurrentLayout ; CurrentLayout := "default" ;
+
+boolean mfun_swapped ;
+
+def SwapPageState =
+ mfun_swapped := true ; % eventually this will go !
+enddef ;
+
+extra_beginfig := extra_beginfig & "mfun_swapped := false ;" ;
+
+newinternal mfid_PaperHeight ; mfid_PaperHeight := scriptindex "PaperHeight" ; vardef PaperHeight = runscript mfid_PaperHeight enddef ;
+newinternal mfid_PaperWidth ; mfid_PaperWidth := scriptindex "PaperWidth" ; vardef PaperWidth = runscript mfid_PaperWidth enddef ;
+newinternal mfid_PrintPaperHeight ; mfid_PrintPaperHeight := scriptindex "PrintPaperHeight" ; vardef PrintPaperHeight = runscript mfid_PrintPaperHeight enddef ;
+newinternal mfid_PrintPaperWidth ; mfid_PrintPaperWidth := scriptindex "PrintPaperWidth" ; vardef PrintPaperWidth = runscript mfid_PrintPaperWidth enddef ;
+newinternal mfid_TopSpace ; mfid_TopSpace := scriptindex "TopSpace" ; vardef TopSpace = runscript mfid_TopSpace enddef ;
+newinternal mfid_BottomSpace ; mfid_BottomSpace := scriptindex "BottomSpace" ; vardef BottomSpace = runscript mfid_BottomSpace enddef ;
+newinternal mfid_BackSpace ; mfid_BackSpace := scriptindex "BackSpace" ; vardef BackSpace = runscript mfid_BackSpace enddef ;
+newinternal mfid_CutSpace ; mfid_CutSpace := scriptindex "CutSpace" ; vardef CutSpace = runscript mfid_CutSpace enddef ;
+newinternal mfid_MakeupHeight ; mfid_MakeupHeight := scriptindex "MakeupHeight" ; vardef MakeupHeight = runscript mfid_MakeupHeight enddef ;
+newinternal mfid_MakeupWidth ; mfid_MakeupWidth := scriptindex "MakeupWidth" ; vardef MakeupWidth = runscript mfid_MakeupWidth enddef ;
+newinternal mfid_TopHeight ; mfid_TopHeight := scriptindex "TopHeight" ; vardef TopHeight = runscript mfid_TopHeight enddef ;
+newinternal mfid_TopDistance ; mfid_TopDistance := scriptindex "TopDistance" ; vardef TopDistance = runscript mfid_TopDistance enddef ;
+newinternal mfid_HeaderHeight ; mfid_HeaderHeight := scriptindex "HeaderHeight" ; vardef HeaderHeight = runscript mfid_HeaderHeight enddef ;
+newinternal mfid_HeaderDistance ; mfid_HeaderDistance := scriptindex "HeaderDistance" ; vardef HeaderDistance = runscript mfid_HeaderDistance enddef ;
+newinternal mfid_TextHeight ; mfid_TextHeight := scriptindex "TextHeight" ; vardef TextHeight = runscript mfid_TextHeight enddef ;
+newinternal mfid_FooterDistance ; mfid_FooterDistance := scriptindex "FooterDistance" ; vardef FooterDistance = runscript mfid_FooterDistance enddef ;
+newinternal mfid_FooterHeight ; mfid_FooterHeight := scriptindex "FooterHeight" ; vardef FooterHeight = runscript mfid_FooterHeight enddef ;
+newinternal mfid_BottomDistance ; mfid_BottomDistance := scriptindex "BottomDistance" ; vardef BottomDistance = runscript mfid_BottomDistance enddef ;
+newinternal mfid_BottomHeight ; mfid_BottomHeight := scriptindex "BottomHeight" ; vardef BottomHeight = runscript mfid_BottomHeight enddef ;
+newinternal mfid_LeftEdgeWidth ; mfid_LeftEdgeWidth := scriptindex "LeftEdgeWidth" ; vardef LeftEdgeWidth = runscript mfid_LeftEdgeWidth enddef ;
+newinternal mfid_LeftEdgeDistance ; mfid_LeftEdgeDistance := scriptindex "LeftEdgeDistance" ; vardef LeftEdgeDistance = runscript mfid_LeftEdgeDistance enddef ;
+newinternal mfid_LeftMarginWidth ; mfid_LeftMarginWidth := scriptindex "LeftMarginWidth" ; vardef LeftMarginWidth = runscript mfid_LeftMarginWidth enddef ;
+newinternal mfid_LeftMarginDistance ; mfid_LeftMarginDistance := scriptindex "LeftMarginDistance" ; vardef LeftMarginDistance = runscript mfid_LeftMarginDistance enddef ;
+newinternal mfid_TextWidth ; mfid_TextWidth := scriptindex "TextWidth" ; vardef TextWidth = runscript mfid_TextWidth enddef ;
+newinternal mfid_RightMarginDistance ; mfid_RightMarginDistance := scriptindex "RightMarginDistance" ; vardef RightMarginDistance = runscript mfid_RightMarginDistance enddef ;
+newinternal mfid_RightMarginWidth ; mfid_RightMarginWidth := scriptindex "RightMarginWidth" ; vardef RightMarginWidth = runscript mfid_RightMarginWidth enddef ;
+newinternal mfid_RightEdgeDistance ; mfid_RightEdgeDistance := scriptindex "RightEdgeDistance" ; vardef RightEdgeDistance = runscript mfid_RightEdgeDistance enddef ;
+newinternal mfid_RightEdgeWidth ; mfid_RightEdgeWidth := scriptindex "RightEdgeWidth" ; vardef RightEdgeWidth = runscript mfid_RightEdgeWidth enddef ;
+newinternal mfid_InnerMarginDistance ; mfid_InnerMarginDistance := scriptindex "InnerMarginDistance" ; vardef InnerMarginDistance = runscript mfid_InnerMarginDistance enddef ;
+newinternal mfid_InnerMarginWidth ; mfid_InnerMarginWidth := scriptindex "InnerMarginWidth" ; vardef InnerMarginWidth = runscript mfid_InnerMarginWidth enddef ;
+newinternal mfid_OuterMarginDistance ; mfid_OuterMarginDistance := scriptindex "OuterMarginDistance" ; vardef OuterMarginDistance = runscript mfid_OuterMarginDistance enddef ;
+newinternal mfid_OuterMarginWidth ; mfid_OuterMarginWidth := scriptindex "OuterMarginWidth" ; vardef OuterMarginWidth = runscript mfid_OuterMarginWidth enddef ;
+newinternal mfid_InnerEdgeDistance ; mfid_InnerEdgeDistance := scriptindex "InnerEdgeDistance" ; vardef InnerEdgeDistance = runscript mfid_InnerEdgeDistance enddef ;
+newinternal mfid_InnerEdgeWidth ; mfid_InnerEdgeWidth := scriptindex "InnerEdgeWidth" ; vardef InnerEdgeWidth = runscript mfid_InnerEdgeWidth enddef ;
+newinternal mfid_OuterEdgeDistance ; mfid_OuterEdgeDistance := scriptindex "OuterEdgeDistance" ; vardef OuterEdgeDistance = runscript mfid_OuterEdgeDistance enddef ;
+newinternal mfid_OuterEdgeWidth ; mfid_OuterEdgeWidth := scriptindex "OuterEdgeWidth" ; vardef OuterEdgeWidth = runscript mfid_OuterEdgeWidth enddef ;
+newinternal mfid_PageOffset ; mfid_PageOffset := scriptindex "PageOffset" ; vardef PageOffset = runscript mfid_PageOffset enddef ;
+newinternal mfid_PageDepth ; mfid_PageDepth := scriptindex "PageDepth" ; vardef PageDepth = runscript mfid_PageDepth enddef ;
+newinternal mfid_LayoutColumns ; mfid_LayoutColumns := scriptindex "LayoutColumns" ; vardef LayoutColumns = runscript mfid_LayoutColumns enddef ;
+newinternal mfid_LayoutColumnDistance ; mfid_LayoutColumnDistance := scriptindex "LayoutColumnDistance" ; vardef LayoutColumnDistance = runscript mfid_LayoutColumnDistance enddef ;
+newinternal mfid_LayoutColumnWidth ; mfid_LayoutColumnWidth := scriptindex "LayoutColumnWidth" ; vardef LayoutColumnWidth = runscript mfid_LayoutColumnWidth enddef ;
+
+newinternal mfid_OnRightPage ; mfid_OnRightPage := scriptindex "OnRightPage" ; vardef OnRightPage = runscript mfid_OnRightPage enddef ;
+newinternal mfid_OnOddPage ; mfid_OnOddPage := scriptindex "OnOddPage" ; vardef OnOddPage = runscript mfid_OnOddPage enddef ;
+newinternal mfid_InPageBody ; mfid_InPageBody := scriptindex "InPageBody" ; vardef InPageBody = runscript mfid_InPageBody enddef ;
+
+newinternal mfid_RealPageNumber ; mfid_RealPageNumber := scriptindex "RealPageNumber" ; vardef RealPageNumber = runscript mfid_RealPageNumber enddef ;
+newinternal mfid_LastPageNumber ; mfid_LastPageNumber := scriptindex "LastPageNumber" ; vardef LastPageNumber = runscript mfid_LastPageNumber enddef ;
+
+newinternal mfid_PageNumber ; mfid_PageNumber := scriptindex "PageNumber" ; vardef PageNumber = runscript mfid_PageNumber enddef ;
+newinternal mfid_NOfPages ; mfid_NOfPages := scriptindex "NOfPages" ; vardef NOfPages = runscript mfid_NOfPages enddef ;
+
+newinternal mfid_SubPageNumber ; mfid_SubPageNumber := scriptindex "SubPageNumber" ; vardef SubPageNumber = runscript mfid_SubPageNumber enddef ;
+newinternal mfid_NOfSubPages ; mfid_NOfSubPages := scriptindex "NOfSubPages" ; vardef NOfSubPages = runscript mfid_NOfSubPages enddef ;
+
+newinternal mfid_CurrentColumn ; mfid_CurrentColumn := scriptindex "CurrentColumn" ; vardef CurrentColumn = runscript mfid_CurrentColumn enddef ;
+newinternal mfid_NOfColumns ; mfid_NOfColumns := scriptindex "NOfColumns" ; vardef NOfColumns = runscript mfid_NOfColumns enddef ;
+
+newinternal mfid_BaseLineSkip ; mfid_BaseLineSkip := scriptindex "BaseLineSkip" ; vardef BaseLineSkip = runscript mfid_BaseLineSkip enddef ;
+newinternal mfid_LineHeight ; mfid_LineHeight := scriptindex "LineHeight" ; vardef LineHeight = runscript mfid_LineHeight enddef ;
+newinternal mfid_BodyFontSize ; mfid_BodyFontSize := scriptindex "BodyFontSize" ; vardef BodyFontSize = runscript mfid_BodyFontSize enddef ;
+
+newinternal mfid_TopSkip ; mfid_TopSkip := scriptindex "TopSkip" ; vardef TopSkip = runscript mfid_TopSkip enddef ;
+newinternal mfid_StrutHeight ; mfid_StrutHeight := scriptindex "StrutHeight" ; vardef StrutHeight = runscript mfid_StrutHeight enddef ;
+newinternal mfid_StrutDepth ; mfid_StrutDepth := scriptindex "StrutDepth" ; vardef StrutDepth = runscript mfid_StrutDepth enddef ;
+
+newinternal mfid_CurrentWidth ; mfid_CurrentWidth := scriptindex "CurrentWidth" ; vardef CurrentWidth = runscript mfid_CurrentWidth enddef ;
+newinternal mfid_CurrentHeight ; mfid_CurrentHeight := scriptindex "CurrentHeight" ; vardef CurrentHeight = runscript mfid_CurrentHeight enddef ;
+
+newinternal mfid_HSize ; mfid_HSize := scriptindex "HSize" ; vardef HSize = runscript mfid_HSize enddef ;
+newinternal mfid_VSize ; mfid_VSize := scriptindex "VSize" ; vardef VSize = runscript mfid_VSize enddef ;
+
+newinternal mfid_EmWidth ; mfid_EmWidth := scriptindex "EmWidth" ; vardef EmWidth = runscript mfid_EmWidth enddef ;
+newinternal mfid_ExHeight ; mfid_ExHeight := scriptindex "ExHeight" ; vardef ExHeight = runscript mfid_ExHeight enddef ;
+
+newinternal mfid_PageFraction ; mfid_PageFraction := scriptindex "PageFraction" ; vardef PageFraction = runscript mfid_PageFraction enddef ;
+
+newinternal mfid_SpineWidth ; mfid_SpineWidth := scriptindex "SpineWidth" ; vardef SpineWidth = runscript mfid_SpineWidth enddef ;
+newinternal mfid_PaperBleed ; mfid_PaperBleed := scriptindex "PaperBleed" ; vardef PaperBleed = runscript mfid_PaperBleed enddef ;
+
+% mfid_CurrentLayout ; mfid_CurrentLayout := scriptindex "CurrentLayout" ; vardef CurrentLayout = runscript mfid_CurrentLayout enddef ;
+newinternal mfid_OverlayWidth ; mfid_OverlayWidth := scriptindex "OverlayWidth" ; vardef OverlayWidth = runscript mfid_OverlayWidth enddef ;
+newinternal mfid_OverlayHeight ; mfid_OverlayHeight := scriptindex "OverlayHeight" ; vardef OverlayHeight = runscript mfid_OverlayHeight enddef ;
+newinternal mfid_OverlayDepth ; mfid_OverlayDepth := scriptindex "OverlayDepth" ; vardef OverlayDepth = runscript mfid_OverlayDepth enddef ;
+newinternal mfid_OverlayLineWidth ; mfid_OverlayLineWidth := scriptindex "OverlayLineWidth" ; vardef OverlayLineWidth = runscript mfid_OverlayLineWidth enddef ;
+newinternal mfid_OverlayOffset ; mfid_OverlayOffset := scriptindex "OverlayOffset" ; vardef OverlayOffset = runscript mfid_OverlayOffset enddef ;
+newinternal mfid_OverlayRegion ; mfid_OverlayRegion := scriptindex "OverlayRegion" ; vardef OverlayRegion = runscript mfid_OverlayRegion enddef ;
+% mfid_OverlayLineColor ; mfid_OverlayLineColor := scriptindex "OverlayLineColor ; vardef OverlayLineColor = runscript mfid_OverlayLineColor enddef ;
+% mfid_OverlayColor ; mfid_OverlayColor := scriptindex "OverlayColor ; vardef OverlayColor = runscript mfid_OverlayColor enddef ;
+
+newinternal mfid_defaultcolormodel ; mfid_defaultcolormodel := scriptindex "defaultcolormodel" ; vardef defaultcolormodel = runscript mfid_defaultcolormodel enddef ;
+
+vardef LeftMarginWidth = if mfun_swapped and not OnRightPage : runscript mfid_RightMarginWidth else : runscript mfid_LeftMarginWidth fi enddef ;
+vardef RightMarginWidth = if mfun_swapped and not OnRightPage : runscript mfid_LeftMarginWidth else : runscript mfid_RightMarginWidth fi enddef ;
+vardef LeftMarginDistance = if mfun_swapped and not OnRightPage : runscript mfid_RightMarginDistance else : runscript mfid_LeftMarginDistance fi enddef ;
+vardef RightMarginDistance = if mfun_swapped and not OnRightPage : runscript mfid_LeftMarginDistance else : runscript mfid_RightMarginDistance fi enddef ;
+
+vardef LeftEdgeWidth = if mfun_swapped and not OnRightPage : runscript mfid_RightEdgeWidth else : runscript mfid_LeftEdgeWidth fi enddef ;
+vardef RightEdgeWidth = if mfun_swapped and not OnRightPage : runscript mfid_LeftEdgeWidth else : runscript mfid_RightEdgeWidth fi enddef ;
+vardef LeftEdgeDistance = if mfun_swapped and not OnRightPage : runscript mfid_RightEdgeDistance else : runscript mfid_LeftEdgeDistance fi enddef ;
+vardef RightEdgeDistance = if mfun_swapped and not OnRightPage : runscript mfid_LeftEdgeDistance else : runscript mfid_RightEdgeDistance fi enddef ;
+
+vardef BackSpace = if mfun_swapped and not OnRightPage : PaperWidth - MakeupWidth - fi runscript mfid_BackSpace enddef ;
+vardef CutSpace = if mfun_swapped and not OnRightPage : PaperWidth - MakeupWidth - fi runscript mfid_CutSpace enddef ;
+
+% better use:
+
+vardef OuterMarginWidth = if not OnRightPage : runscript mfid_LeftMarginWidth else : runscript mfid_RightMarginWidth fi enddef ;
+vardef InnerMarginWidth = if not OnRightPage : runscript mfid_RightMarginWidth else : runscript mfid_LeftMarginWidth fi enddef ;
+vardef OuterMarginDistance = if not OnRightPage : runscript mfid_LeftMarginDistance else : runscript mfid_RightMarginDistance fi enddef ;
+vardef InnerMarginDistance = if not OnRightPage : runscript mfid_RightMarginDistance else : runscript mfid_LeftMarginDistance fi enddef ;
+
+vardef OuterEdgeWidth = if not OnRightPage : runscript mfid_LeftEdgeWidth else : runscript mfid_RightEdgeWidth fi enddef ;
+vardef InnerEdgeWidth = if not OnRightPage : runscript mfid_RightEdgeWidth else : runscript mfid_LeftEdgeWidth fi enddef ;
+vardef OuterEdgeDistance = if not OnRightPage : runscript mfid_LeftEdgeDistance else : runscript mfid_RightEdgeDistance fi enddef ;
+vardef InnerEdgeDistance = if not OnRightPage : runscript mfid_RightEdgeDistance else : runscript mfid_LeftEdgeDistance fi enddef ;
+
+vardef OuterSpaceWidth = if not OnRightPage : runscript mfid_BackSpace else : runscript mfid_CutSpace fi enddef ;
+vardef InnerSpaceWidth = if not OnRightPage : runscript mfid_CutSpace else : runscript mfid_BackSpace fi enddef ;
+
+% indices
+
+vardef OuterMargin = if not OnRightPage : LeftMargin else : RightMargin fi enddef ;
+vardef InnerMargin = if not OnRightPage : RightMargin else : LeftMargin fi enddef ;
+
+vardef OuterEdge = if not OnRightPage : LeftEdge else : RightEdge fi enddef ;
+vardef InnerEdge = if not OnRightPage : Rightedge else : LeftEdge fi enddef ;
+
+
diff --git a/metapost/context/base/mpiv/mp-luas.mpxl b/metapost/context/base/mpiv/mp-luas.mpxl
index 0dac5cefc..2bdeb915c 100644
--- a/metapost/context/base/mpiv/mp-luas.mpxl
+++ b/metapost/context/base/mpiv/mp-luas.mpxl
@@ -221,3 +221,12 @@ def getparametertext = runscript mfid_getparametertext enddef ;
def applyparameters = runscript mfid_applyparameters enddef ;
def pushparameters = runscript mfid_pushparameters enddef ;
def popparameters = runscript mfid_popparameters enddef ;
+
+% This might also be done in stock mkiv:
+
+newinternal mfid_year ; mfid_year := scriptindex "year" ; vardef year = runscript mfid_year enddef ;
+newinternal mfid_month ; mfid_month := scriptindex "month" ; vardef month = runscript mfid_month enddef ;
+newinternal mfid_day ; mfid_day := scriptindex "day" ; vardef day = runscript mfid_day enddef ;
+newinternal mfid_hour ; mfid_hour := scriptindex "hour" ; vardef hour = runscript mfid_hour enddef ;
+newinternal mfid_minute ; mfid_minute := scriptindex "minute" ; vardef minute = runscript mfid_minute enddef ;
+newinternal mfid_second ; mfid_second := scriptindex "second" ; vardef second = runscript mfid_second enddef ;
diff --git a/metapost/context/base/mpiv/mp-math.mpxl b/metapost/context/base/mpiv/mp-math.mpxl
index 52fbd1615..ea8c1cd7c 100644
--- a/metapost/context/base/mpiv/mp-math.mpxl
+++ b/metapost/context/base/mpiv/mp-math.mpxl
@@ -17,98 +17,98 @@ boolean context_math ; context_math := true ;
% draw textext(decimal runscript("mp.numeric(xmath.gamma(.12))")) ;
-newinternal mfid_m_acos ; mfid_m_acos := scriptindex "m_acos" ; def m_acos = runscript mfid_m_acos enddef ;
-newinternal mfid_m_acosh ; mfid_m_acosh := scriptindex "m_acosh" ; def m_acosh = runscript mfid_m_acosh enddef ;
-newinternal mfid_m_asin ; mfid_m_asin := scriptindex "m_asin" ; def m_asin = runscript mfid_m_asin enddef ;
-newinternal mfid_m_asinh ; mfid_m_asinh := scriptindex "m_asinh" ; def m_asinh = runscript mfid_m_asinh enddef ;
-newinternal mfid_m_atan ; mfid_m_atan := scriptindex "m_atan" ; def m_atan = runscript mfid_m_atan enddef ;
-newinternal mfid_m_atantwo ; mfid_m_atantwo := scriptindex "m_atan2" ; def m_atantwo = runscript mfid_m_atantwo enddef ; % atan2
-newinternal mfid_m_atanh ; mfid_m_atanh := scriptindex "m_atanh" ; def m_atanh = runscript mfid_m_atanh enddef ;
-newinternal mfid_m_cbrt ; mfid_m_cbrt := scriptindex "m_cbrt" ; def m_cbrt = runscript mfid_m_cbrt enddef ;
-newinternal mfid_m_ceil ; mfid_m_ceil := scriptindex "m_ceil" ; def m_ceil = runscript mfid_m_ceil enddef ;
-newinternal mfid_m_copysign ; mfid_m_copysign := scriptindex "m_copysign" ; def m_copysign = runscript mfid_m_copysign enddef ;
-newinternal mfid_m_cos ; mfid_m_cos := scriptindex "m_cos" ; def m_cos = runscript mfid_m_cos enddef ;
-newinternal mfid_m_cosh ; mfid_m_cosh := scriptindex "m_cosh" ; def m_cosh = runscript mfid_m_cosh enddef ;
-newinternal mfid_m_deg ; mfid_m_deg := scriptindex "m_deg" ; def m_deg = runscript mfid_m_deg enddef ;
-newinternal mfid_m_erf ; mfid_m_erf := scriptindex "m_erf" ; def m_erf = runscript mfid_m_erf enddef ;
-newinternal mfid_m_erfc ; mfid_m_erfc := scriptindex "m_erfc" ; def m_erfc = runscript mfid_m_erfc enddef ;
-newinternal mfid_m_exp ; mfid_m_exp := scriptindex "m_exp" ; def m_exp = runscript mfid_m_exp enddef ;
-newinternal mfid_m_exptwo ; mfid_m_exptwo := scriptindex "m_exp2" ; def m_exptwo = runscript mfid_m_exptwo enddef ; % exp2
-newinternal mfid_m_expm ; mfid_m_expm := scriptindex "m_expm1" ; def m_expm = runscript mfid_m_expm enddef ; % expm1
-newinternal mfid_m_fabs ; mfid_m_fabs := scriptindex "m_fabs" ; def m_fabs = runscript mfid_m_fabs enddef ;
-newinternal mfid_m_fdim ; mfid_m_fdim := scriptindex "m_fdim" ; def m_fdim = runscript mfid_m_fdim enddef ;
-newinternal mfid_m_floor ; mfid_m_floor := scriptindex "m_floor" ; def m_floor = runscript mfid_m_floor enddef ;
-newinternal mfid_m_fma ; mfid_m_fma := scriptindex "m_fma" ; def m_fma = runscript mfid_m_fma enddef ;
-newinternal mfid_m_fmax ; mfid_m_fmax := scriptindex "m_fmax" ; def m_fmax = runscript mfid_m_fmax enddef ;
-newinternal mfid_m_fmin ; mfid_m_fmin := scriptindex "m_fmin" ; def m_fmin = runscript mfid_m_fmin enddef ;
-newinternal mfid_m_fmod ; mfid_m_fmod := scriptindex "m_fmod" ; def m_fmod = runscript mfid_m_fmod enddef ;
-newinternal mfid_m_frexp ; mfid_m_frexp := scriptindex "m_frexp" ; def m_frexp = runscript mfid_m_frexp enddef ;
-newinternal mfid_m_gamma ; mfid_m_gamma := scriptindex "m_gamma" ; def m_gamma = runscript mfid_m_gamma enddef ;
-newinternal mfid_m_hypot ; mfid_m_hypot := scriptindex "m_hypot" ; def m_hypot = runscript mfid_m_hypot enddef ;
-newinternal mfid_m_isfinite ; mfid_m_isfinite := scriptindex "m_isfinite" ; def m_isfinite = runscript mfid_m_isfinite enddef ;
-newinternal mfid_m_isinf ; mfid_m_isinf := scriptindex "m_isinf" ; def m_isinf = runscript mfid_m_isinf enddef ;
-newinternal mfid_m_isnan ; mfid_m_isnan := scriptindex "m_isnan" ; def m_isnan = runscript mfid_m_isnan enddef ;
-newinternal mfid_m_isnormal ; mfid_m_isnormal := scriptindex "m_isnormal" ; def m_isnormal = runscript mfid_m_isnormal enddef ;
-newinternal mfid_m_jz ; mfid_m_jz := scriptindex "m_j0" ; def m_jz = runscript mfid_m_jz enddef ; % j0
-newinternal mfid_m_j ; mfid_m_j := scriptindex "m_j1" ; def m_j = runscript mfid_m_j enddef ; % j1
-newinternal mfid_m_jn ; mfid_m_jn := scriptindex "m_jn" ; def m_jn = runscript mfid_m_jn enddef ;
-newinternal mfid_m_ldexp ; mfid_m_ldexp := scriptindex "m_ldexp" ; def m_ldexp = runscript mfid_m_ldexp enddef ;
-newinternal mfid_m_lgamma ; mfid_m_lgamma := scriptindex "m_lgamma" ; def m_lgamma = runscript mfid_m_lgamma enddef ;
-newinternal mfid_m_log ; mfid_m_log := scriptindex "m_log" ; def m_log = runscript mfid_m_log enddef ;
-newinternal mfid_m_logten ; mfid_m_logte := scriptindex "m_log10" ; def m_logten = runscript mfid_m_logten enddef ; % log10
-newinternal mfid_m_logp ; mfid_m_logp := scriptindex "m_log1p" ; def m_logp = runscript mfid_m_logp enddef ; % log1p
-newinternal mfid_m_logtwo ; mfid_m_logtwo := scriptindex "m_log2" ; def m_logtwo = runscript mfid_m_logtwo enddef ; % log2
-newinternal mfid_m_logb ; mfid_m_logb := scriptindex "m_logb" ; def m_logb = runscript mfid_m_logb enddef ;
-newinternal mfid_m_modf ; mfid_m_modf := scriptindex "m_modf" ; def m_modf = runscript mfid_m_modf enddef ;
+newinternal mfid_m_acos ; mfid_m_acos := scriptindex "m_acos" ; def m_acos = runscript mfid_m_acos enddef ;
+newinternal mfid_m_acosh ; mfid_m_acosh := scriptindex "m_acosh" ; def m_acosh = runscript mfid_m_acosh enddef ;
+newinternal mfid_m_asin ; mfid_m_asin := scriptindex "m_asin" ; def m_asin = runscript mfid_m_asin enddef ;
+newinternal mfid_m_asinh ; mfid_m_asinh := scriptindex "m_asinh" ; def m_asinh = runscript mfid_m_asinh enddef ;
+newinternal mfid_m_atan ; mfid_m_atan := scriptindex "m_atan" ; def m_atan = runscript mfid_m_atan enddef ;
+newinternal mfid_m_atantwo ; mfid_m_atantwo := scriptindex "m_atan2" ; def m_atantwo = runscript mfid_m_atantwo enddef ; % atan2
+newinternal mfid_m_atanh ; mfid_m_atanh := scriptindex "m_atanh" ; def m_atanh = runscript mfid_m_atanh enddef ;
+newinternal mfid_m_cbrt ; mfid_m_cbrt := scriptindex "m_cbrt" ; def m_cbrt = runscript mfid_m_cbrt enddef ;
+newinternal mfid_m_ceil ; mfid_m_ceil := scriptindex "m_ceil" ; def m_ceil = runscript mfid_m_ceil enddef ;
+newinternal mfid_m_copysign ; mfid_m_copysign := scriptindex "m_copysign" ; def m_copysign = runscript mfid_m_copysign enddef ;
+newinternal mfid_m_cos ; mfid_m_cos := scriptindex "m_cos" ; def m_cos = runscript mfid_m_cos enddef ;
+newinternal mfid_m_cosh ; mfid_m_cosh := scriptindex "m_cosh" ; def m_cosh = runscript mfid_m_cosh enddef ;
+newinternal mfid_m_deg ; mfid_m_deg := scriptindex "m_deg" ; def m_deg = runscript mfid_m_deg enddef ;
+newinternal mfid_m_erf ; mfid_m_erf := scriptindex "m_erf" ; def m_erf = runscript mfid_m_erf enddef ;
+newinternal mfid_m_erfc ; mfid_m_erfc := scriptindex "m_erfc" ; def m_erfc = runscript mfid_m_erfc enddef ;
+newinternal mfid_m_exp ; mfid_m_exp := scriptindex "m_exp" ; def m_exp = runscript mfid_m_exp enddef ;
+newinternal mfid_m_exptwo ; mfid_m_exptwo := scriptindex "m_exp2" ; def m_exptwo = runscript mfid_m_exptwo enddef ; % exp2
+newinternal mfid_m_expm ; mfid_m_expm := scriptindex "m_expm1" ; def m_expm = runscript mfid_m_expm enddef ; % expm1
+newinternal mfid_m_fabs ; mfid_m_fabs := scriptindex "m_fabs" ; def m_fabs = runscript mfid_m_fabs enddef ;
+newinternal mfid_m_fdim ; mfid_m_fdim := scriptindex "m_fdim" ; def m_fdim = runscript mfid_m_fdim enddef ;
+newinternal mfid_m_floor ; mfid_m_floor := scriptindex "m_floor" ; def m_floor = runscript mfid_m_floor enddef ;
+newinternal mfid_m_fma ; mfid_m_fma := scriptindex "m_fma" ; def m_fma = runscript mfid_m_fma enddef ;
+newinternal mfid_m_fmax ; mfid_m_fmax := scriptindex "m_fmax" ; def m_fmax = runscript mfid_m_fmax enddef ;
+newinternal mfid_m_fmin ; mfid_m_fmin := scriptindex "m_fmin" ; def m_fmin = runscript mfid_m_fmin enddef ;
+newinternal mfid_m_fmod ; mfid_m_fmod := scriptindex "m_fmod" ; def m_fmod = runscript mfid_m_fmod enddef ;
+newinternal mfid_m_frexp ; mfid_m_frexp := scriptindex "m_frexp" ; def m_frexp = runscript mfid_m_frexp enddef ;
+newinternal mfid_m_gamma ; mfid_m_gamma := scriptindex "m_gamma" ; def m_gamma = runscript mfid_m_gamma enddef ;
+newinternal mfid_m_hypot ; mfid_m_hypot := scriptindex "m_hypot" ; def m_hypot = runscript mfid_m_hypot enddef ;
+newinternal mfid_m_isfinite ; mfid_m_isfinite := scriptindex "m_isfinite" ; def m_isfinite = runscript mfid_m_isfinite enddef ;
+newinternal mfid_m_isinf ; mfid_m_isinf := scriptindex "m_isinf" ; def m_isinf = runscript mfid_m_isinf enddef ;
+newinternal mfid_m_isnan ; mfid_m_isnan := scriptindex "m_isnan" ; def m_isnan = runscript mfid_m_isnan enddef ;
+newinternal mfid_m_isnormal ; mfid_m_isnormal := scriptindex "m_isnormal" ; def m_isnormal = runscript mfid_m_isnormal enddef ;
+newinternal mfid_m_jz ; mfid_m_jz := scriptindex "m_j0" ; def m_jz = runscript mfid_m_jz enddef ; % j0
+newinternal mfid_m_j ; mfid_m_j := scriptindex "m_j1" ; def m_j = runscript mfid_m_j enddef ; % j1
+newinternal mfid_m_jn ; mfid_m_jn := scriptindex "m_jn" ; def m_jn = runscript mfid_m_jn enddef ;
+newinternal mfid_m_ldexp ; mfid_m_ldexp := scriptindex "m_ldexp" ; def m_ldexp = runscript mfid_m_ldexp enddef ;
+newinternal mfid_m_lgamma ; mfid_m_lgamma := scriptindex "m_lgamma" ; def m_lgamma = runscript mfid_m_lgamma enddef ;
+newinternal mfid_m_log ; mfid_m_log := scriptindex "m_log" ; def m_log = runscript mfid_m_log enddef ;
+newinternal mfid_m_logten ; mfid_m_logte := scriptindex "m_log10" ; def m_logten = runscript mfid_m_logten enddef ; % log10
+newinternal mfid_m_logp ; mfid_m_logp := scriptindex "m_log1p" ; def m_logp = runscript mfid_m_logp enddef ; % log1p
+newinternal mfid_m_logtwo ; mfid_m_logtwo := scriptindex "m_log2" ; def m_logtwo = runscript mfid_m_logtwo enddef ; % log2
+newinternal mfid_m_logb ; mfid_m_logb := scriptindex "m_logb" ; def m_logb = runscript mfid_m_logb enddef ;
+newinternal mfid_m_modf ; mfid_m_modf := scriptindex "m_modf" ; def m_modf = runscript mfid_m_modf enddef ;
newinternal mfid_m_nearbyint ; mfid_m_nearbyint := scriptindex "m_nearbyint" ; def m_nearbyint = runscript mfid_m_nearbyint enddef ;
newinternal mfid_m_nextafter ; mfid_m_nextafter := scriptindex "m_nextafter" ; def m_nextafter = runscript mfid_m_nextafter enddef ;
-newinternal mfid_m_pow ; mfid_m_pow := scriptindex "m_pow" ; def m_pow = runscript mfid_m_pow enddef ;
-newinternal mfid_m_rad ; mfid_m_rad := scriptindex "m_rad" ; def m_rad = runscript mfid_m_rad enddef ;
+newinternal mfid_m_pow ; mfid_m_pow := scriptindex "m_pow" ; def m_pow = runscript mfid_m_pow enddef ;
+newinternal mfid_m_rad ; mfid_m_rad := scriptindex "m_rad" ; def m_rad = runscript mfid_m_rad enddef ;
newinternal mfid_m_remainder ; mfid_m_remainder := scriptindex "m_remainder" ; def m_remainder = runscript mfid_m_remainder enddef ;
-newinternal mfid_m_remquo ; mfid_m_remquo := scriptindex "m_remquo" ; def m_remquo = runscript mfid_m_remquo enddef ;
-newinternal mfid_m_round ; mfid_m_round := scriptindex "m_round" ; def m_round = runscript mfid_m_round enddef ;
-newinternal mfid_m_scalbn ; mfid_m_scalbn := scriptindex "m_scalbn" ; def m_scalbn = runscript mfid_m_scalbn enddef ;
-newinternal mfid_m_sin ; mfid_m_sin := scriptindex "m_sin" ; def m_sin = runscript mfid_m_sin enddef ;
-newinternal mfid_m_sinh ; mfid_m_sinh := scriptindex "m_sinh" ; def m_sinh = runscript mfid_m_sinh enddef ;
-newinternal mfid_m_sqrt ; mfid_m_sqrt := scriptindex "m_sqrt" ; def m_sqrt = runscript mfid_m_sqrt enddef ;
-newinternal mfid_m_tan ; mfid_m_tan := scriptindex "m_tan" ; def m_tan = runscript mfid_m_tan enddef ;
-newinternal mfid_m_tanh ; mfid_m_tanh := scriptindex "m_tanh" ; def m_tanh = runscript mfid_m_tanh enddef ;
-newinternal mfid_m_tgamma ; mfid_m_tgamma := scriptindex "m_tgamma" ; def m_tgamma = runscript mfid_m_tgamma enddef ;
-newinternal mfid_m_trunc ; mfid_m_trunc := scriptindex "m_trunc" ; def m_trunc = runscript mfid_m_trunc enddef ;
-newinternal mfid_m_yz ; mfid_m_yz := scriptindex "m_y0" ; def m_yz = runscript mfid_m_yz enddef ; % y0
-newinternal mfid_m_y ; mfid_m_y := scriptindex "m_y1" ; def m_y = runscript mfid_m_y enddef ; % y1
-newinternal mfid_m_yn ; mfid_m_yn := scriptindex "m_yn" ; def m_yn = runscript mfid_m_yn enddef ;
-
-newinternal mfid_c_sin ; mfid_c_asin := scriptindex "c_sin" ; def c_sin = runscript mfid_c_sin enddef ;
-newinternal mfid_c_cos ; mfid_c_acos := scriptindex "c_cos" ; def c_cos = runscript mfid_c_cos enddef ;
-newinternal mfid_c_tan ; mfid_c_acos := scriptindex "c_tan" ; def c_tan = runscript mfid_c_tan enddef ;
-newinternal mfid_c_sinh ; mfid_c_acos := scriptindex "c_sinh" ; def c_sinh = runscript mfid_c_sinh enddef ;
-newinternal mfid_c_cosh ; mfid_c_acos := scriptindex "c_cosh" ; def c_cosh = runscript mfid_c_cosh enddef ;
-newinternal mfid_c_tanh ; mfid_c_acos := scriptindex "c_tanh" ; def c_tanh = runscript mfid_c_tanh enddef ;
-
-newinternal mfid_c_asin ; mfid_c_acos := scriptindex "c_asin" ; def c_asin = runscript mfid_c_asin enddef ;
-newinternal mfid_c_acos ; mfid_c_acos := scriptindex "c_acos" ; def c_acos = runscript mfid_c_acos enddef ;
-newinternal mfid_c_atan ; mfid_c_acos := scriptindex "c_atan" ; def c_atan = runscript mfid_c_atan enddef ;
-newinternal mfid_c_asinh ; mfid_c_acos := scriptindex "c_asinh" ; def c_asinh = runscript mfid_c_asinh enddef ;
-newinternal mfid_c_acosh ; mfid_c_acos := scriptindex "c_acosh" ; def c_acosh = runscript mfid_c_acosh enddef ;
-newinternal mfid_c_atanh ; mfid_c_acos := scriptindex "c_atanh" ; def c_atanh = runscript mfid_c_atanh enddef ;
-
-newinternal mfid_c_sqrt ; mfid_c_acos := scriptindex "c_sqrt" ; def c_sqrt = runscript mfid_c_sqrt enddef ;
-newinternal mfid_c_abs ; mfid_c_acos := scriptindex "c_abs" ; def c_abs = runscript mfid_c_abs enddef ;
-newinternal mfid_c_arg ; mfid_c_acos := scriptindex "c_arg" ; def c_arg = runscript mfid_c_arg enddef ;
-newinternal mfid_c_conj ; mfid_c_acos := scriptindex "c_conj" ; def c_conj = runscript mfid_c_conj enddef ;
-newinternal mfid_c_exp ; mfid_c_acos := scriptindex "c_exp" ; def c_exp = runscript mfid_c_exp enddef ;
-newinternal mfid_c_log ; mfid_c_acos := scriptindex "c_log" ; def c_log = runscript mfid_c_log enddef ;
-newinternal mfid_c_proj ; mfid_c_acos := scriptindex "c_proj" ; def c_proj = runscript mfid_c_proj enddef ;
-
-newinternal mfid_c_erf ; mfid_c_erf := scriptindex "c_erf" ; def c_erf = runscript mfid_c_erf enddef ;
-newinternal mfid_c_erfc ; mfid_c_erfc := scriptindex "c_erfc" ; def c_erfc = runscript mfid_c_erfc enddef ;
-newinternal mfid_c_erfcx ; mfid_c_erfcx := scriptindex "c_erfcx" ; def c_erfcx = runscript mfid_c_erfcx enddef ;
-newinternal mfid_c_erfi ; mfid_c_erfi := scriptindex "c_erfi" ; def c_erfi = runscript mfid_c_erfi enddef ;
-
-% mfid_c_imag ; mfid_c_acos := scriptindex "c_imag" ; def c_imag = runscript mfid_c_imag enddef ;
-% mfid_c_real ; mfid_c_acos := scriptindex "c_real" ; def c_real = runscript mfid_c_real enddef ;
-% mfid_c_neg ; mfid_c_neg := scriptindex "c_neg" ; def c_neg = runscript mfid_c_neg enddef ;
+newinternal mfid_m_remquo ; mfid_m_remquo := scriptindex "m_remquo" ; def m_remquo = runscript mfid_m_remquo enddef ;
+newinternal mfid_m_round ; mfid_m_round := scriptindex "m_round" ; def m_round = runscript mfid_m_round enddef ;
+newinternal mfid_m_scalbn ; mfid_m_scalbn := scriptindex "m_scalbn" ; def m_scalbn = runscript mfid_m_scalbn enddef ;
+newinternal mfid_m_sin ; mfid_m_sin := scriptindex "m_sin" ; def m_sin = runscript mfid_m_sin enddef ;
+newinternal mfid_m_sinh ; mfid_m_sinh := scriptindex "m_sinh" ; def m_sinh = runscript mfid_m_sinh enddef ;
+newinternal mfid_m_sqrt ; mfid_m_sqrt := scriptindex "m_sqrt" ; def m_sqrt = runscript mfid_m_sqrt enddef ;
+newinternal mfid_m_tan ; mfid_m_tan := scriptindex "m_tan" ; def m_tan = runscript mfid_m_tan enddef ;
+newinternal mfid_m_tanh ; mfid_m_tanh := scriptindex "m_tanh" ; def m_tanh = runscript mfid_m_tanh enddef ;
+newinternal mfid_m_tgamma ; mfid_m_tgamma := scriptindex "m_tgamma" ; def m_tgamma = runscript mfid_m_tgamma enddef ;
+newinternal mfid_m_trunc ; mfid_m_trunc := scriptindex "m_trunc" ; def m_trunc = runscript mfid_m_trunc enddef ;
+newinternal mfid_m_yz ; mfid_m_yz := scriptindex "m_y0" ; def m_yz = runscript mfid_m_yz enddef ; % y0
+newinternal mfid_m_y ; mfid_m_y := scriptindex "m_y1" ; def m_y = runscript mfid_m_y enddef ; % y1
+newinternal mfid_m_yn ; mfid_m_yn := scriptindex "m_yn" ; def m_yn = runscript mfid_m_yn enddef ;
+
+newinternal mfid_c_sin ; mfid_c_asin := scriptindex "c_sin" ; def c_sin = runscript mfid_c_sin enddef ;
+newinternal mfid_c_cos ; mfid_c_acos := scriptindex "c_cos" ; def c_cos = runscript mfid_c_cos enddef ;
+newinternal mfid_c_tan ; mfid_c_acos := scriptindex "c_tan" ; def c_tan = runscript mfid_c_tan enddef ;
+newinternal mfid_c_sinh ; mfid_c_acos := scriptindex "c_sinh" ; def c_sinh = runscript mfid_c_sinh enddef ;
+newinternal mfid_c_cosh ; mfid_c_acos := scriptindex "c_cosh" ; def c_cosh = runscript mfid_c_cosh enddef ;
+newinternal mfid_c_tanh ; mfid_c_acos := scriptindex "c_tanh" ; def c_tanh = runscript mfid_c_tanh enddef ;
+
+newinternal mfid_c_asin ; mfid_c_acos := scriptindex "c_asin" ; def c_asin = runscript mfid_c_asin enddef ;
+newinternal mfid_c_acos ; mfid_c_acos := scriptindex "c_acos" ; def c_acos = runscript mfid_c_acos enddef ;
+newinternal mfid_c_atan ; mfid_c_acos := scriptindex "c_atan" ; def c_atan = runscript mfid_c_atan enddef ;
+newinternal mfid_c_asinh ; mfid_c_acos := scriptindex "c_asinh" ; def c_asinh = runscript mfid_c_asinh enddef ;
+newinternal mfid_c_acosh ; mfid_c_acos := scriptindex "c_acosh" ; def c_acosh = runscript mfid_c_acosh enddef ;
+newinternal mfid_c_atanh ; mfid_c_acos := scriptindex "c_atanh" ; def c_atanh = runscript mfid_c_atanh enddef ;
+
+newinternal mfid_c_sqrt ; mfid_c_acos := scriptindex "c_sqrt" ; def c_sqrt = runscript mfid_c_sqrt enddef ;
+newinternal mfid_c_abs ; mfid_c_acos := scriptindex "c_abs" ; def c_abs = runscript mfid_c_abs enddef ;
+newinternal mfid_c_arg ; mfid_c_acos := scriptindex "c_arg" ; def c_arg = runscript mfid_c_arg enddef ;
+newinternal mfid_c_conj ; mfid_c_acos := scriptindex "c_conj" ; def c_conj = runscript mfid_c_conj enddef ;
+newinternal mfid_c_exp ; mfid_c_acos := scriptindex "c_exp" ; def c_exp = runscript mfid_c_exp enddef ;
+newinternal mfid_c_log ; mfid_c_acos := scriptindex "c_log" ; def c_log = runscript mfid_c_log enddef ;
+newinternal mfid_c_proj ; mfid_c_acos := scriptindex "c_proj" ; def c_proj = runscript mfid_c_proj enddef ;
+
+newinternal mfid_c_erf ; mfid_c_erf := scriptindex "c_erf" ; def c_erf = runscript mfid_c_erf enddef ;
+newinternal mfid_c_erfc ; mfid_c_erfc := scriptindex "c_erfc" ; def c_erfc = runscript mfid_c_erfc enddef ;
+newinternal mfid_c_erfcx ; mfid_c_erfcx := scriptindex "c_erfcx" ; def c_erfcx = runscript mfid_c_erfcx enddef ;
+newinternal mfid_c_erfi ; mfid_c_erfi := scriptindex "c_erfi" ; def c_erfi = runscript mfid_c_erfi enddef ;
+
+% mfid_c_imag ; mfid_c_acos := scriptindex "c_imag" ; def c_imag = runscript mfid_c_imag enddef ;
+% mfid_c_real ; mfid_c_acos := scriptindex "c_real" ; def c_real = runscript mfid_c_real enddef ;
+% mfid_c_neg ; mfid_c_neg := scriptindex "c_neg" ; def c_neg = runscript mfid_c_neg enddef ;
newinternal mfid_c_pow ; mfid_c_pow := scriptindex "c_pow" ; def c_pow (expr a,b) = runscript mfid_c_pow a b enddef ;
% mfid_c_add ; mfid_c_add := scriptindex "c_add" ; def c_add (expr a,b) = runscript mfid_c_add a b enddef ;
@@ -125,29 +125,37 @@ vardef c_imag(expr a) = ypart a enddef ;
vardef c_real(expr a) = xpart a enddef ;
vardef c_neg (expr a) = -a enddef ;
-% to be redefined:
+if (numbersystem == "scaled") or (numbersystem == "double") :
-% vardef sqr primary x = x*x enddef ;
-% vardef log primary x = if x=0: 0 else: mlog(x)/mlog(10) fi enddef ;
-% vardef ln primary x = if x=0: 0 else: mlog(x)/256 fi enddef ;
-% vardef exp primary x = (mexp 256)**x enddef ;
-% vardef inv primary x = if x=0: 0 else: x**-1 fi enddef ;
+ % vardef sqrt primary x = m_sqrt x enddef ;
-% vardef tand primary x = sind(x)/cosd(x) enddef ;
-% vardef cotd primary x = cosd(x)/sind(x) enddef ;
+ % vardef sqr primary x = x*x enddef ;
+ % vardef log primary x = if x=0: 0 else: mlog(x)/mlog(10) fi enddef ;
+ % vardef ln primary x = if x=0: 0 else: mlog(x)/256 fi enddef ;
+ % vardef exp primary x = (mexp 256)**x enddef ;
+ % vardef inv primary x = if x=0: 0 else: x**-1 fi enddef ;
-% vardef invsin primary x = (asin(x))/radian enddef ;
-% vardef invcos primary x = (acos(x))/radian enddef ;
-% vardef invtan primary x = (atan(x))/radian enddef ;
+ vardef sin primary x = m_sin x enddef ; vardef sinh primary x = m_sinh x enddef ;
+ vardef cos primary x = m_cos x enddef ; vardef cosh primary x = m_cosh x enddef ;
+ vardef tan primary x = m_tan x enddef ; vardef tanh primary x = m_tanh x enddef ;
+ vardef asin primary x = m_asin x enddef ; vardef asinh primary x = m_asinh x enddef ;
+ vardef acos primary x = m_acos x enddef ; vardef acosh primary x = m_acosh x enddef ;
+ vardef atan primary x = m_atan x enddef ; vardef atanh primary x = m_atanh x enddef ;
-% vardef sin primary x = m_sin x enddef ; vardef sinh primary x = m_sinh x enddef ;
-% vardef cos primary x = m_cos x enddef ; vardef cosh primary x = m_cosh x enddef ;
-% vardef tan primary x = m_tan x enddef ; vardef tanh primary x = m_tanh x enddef ;
-% vardef asin primary x = m_asin x enddef ; vardef asinh primary x = m_asinh x enddef ;
-% vardef acos primary x = m_acos x enddef ; vardef acosh primary x = m_acosh x enddef ;
-% vardef atan primary x = m_atan x enddef ; vardef atanh primary x = m_atanh x enddef ;
+ vardef invsin primary x = (m_asin(x))/radian enddef ;
+ vardef invcos primary x = (m_acos(x))/radian enddef ;
+ vardef invtan primary x = (m_atan(x))/radian enddef ;
-% vardef sind primary x = angle(m_sin x) enddef ; vardef asind primary x = angle(m_asin x) enddef ;
-% vardef cosd primary x = angle(m_cos x) enddef ; vardef acosd primary x = angle(m_acos x) enddef ;
-% vardef tand primary x = angle(m_tan x) enddef ; vardef atand primary x = angle(m_atan x) enddef ;
+ % vardef sind primary x = angle(m_sin x) enddef ;
+ % vardef cosd primary x = angle(m_cos x) enddef ;
+ % vardef tand primary x = angle(m_tan x) enddef ;
+
+ vardef asind primary x = angle(m_asin x) enddef ;
+ vardef acosd primary x = angle(m_acos x) enddef ;
+ vardef atand primary x = angle(m_atan x) enddef ;
+
+ % vardef tand primary x = sind(x)/cosd(x) enddef ;
+ % vardef cotd primary x = cosd(x)/sind(x) enddef ;
+
+fi ;
diff --git a/metapost/context/base/mpiv/mp-page.mpiv b/metapost/context/base/mpiv/mp-page.mpiv
index a996bfd66..18e28d6ca 100644
--- a/metapost/context/base/mpiv/mp-page.mpiv
+++ b/metapost/context/base/mpiv/mp-page.mpiv
@@ -186,148 +186,6 @@ if unknown PageStateAvailable :
PageStateAvailable := false ;
fi ;
-string CurrentLayout ; CurrentLayout := "default" ;
-
-% runscript("mp.PaperHeight()") is much faster than lua.mp.PaperHeight() so we use that now:
-
-vardef PaperHeight = runscript("mp.PaperHeight()") enddef ;
-vardef PaperWidth = runscript("mp.PaperWidth()") enddef ;
-vardef PrintPaperHeight = runscript("mp.PrintPaperHeight()") enddef ;
-vardef PrintPaperWidth = runscript("mp.PrintPaperWidth()") enddef ;
-vardef TopSpace = runscript("mp.TopSpace()") enddef ;
-vardef BottomSpace = runscript("mp.BottomSpace()") enddef ;
-vardef BackSpace = runscript("mp.BackSpace()") enddef ;
-vardef CutSpace = runscript("mp.CutSpace()") enddef ;
-vardef MakeupHeight = runscript("mp.MakeupHeight()") enddef ;
-vardef MakeupWidth = runscript("mp.MakeupWidth()") enddef ;
-vardef TopHeight = runscript("mp.TopHeight()") enddef ;
-vardef TopDistance = runscript("mp.TopDistance()") enddef ;
-vardef HeaderHeight = runscript("mp.HeaderHeight()") enddef ;
-vardef HeaderDistance = runscript("mp.HeaderDistance()") enddef ;
-vardef TextHeight = runscript("mp.TextHeight()") enddef ;
-vardef FooterDistance = runscript("mp.FooterDistance()") enddef ;
-vardef FooterHeight = runscript("mp.FooterHeight()") enddef ;
-vardef BottomDistance = runscript("mp.BottomDistance()") enddef ;
-vardef BottomHeight = runscript("mp.BottomHeight()") enddef ;
-vardef LeftEdgeWidth = runscript("mp.LeftEdgeWidth()") enddef ;
-vardef LeftEdgeDistance = runscript("mp.LeftEdgeDistance()") enddef ;
-vardef LeftMarginWidth = runscript("mp.LeftMarginWidth()") enddef ;
-vardef LeftMarginDistance = runscript("mp.LeftMarginDistance()") enddef ;
-vardef TextWidth = runscript("mp.TextWidth()") enddef ;
-vardef RightMarginDistance = runscript("mp.RightMarginDistance()") enddef ;
-vardef RightMarginWidth = runscript("mp.RightMarginWidth()") enddef ;
-vardef RightEdgeDistance = runscript("mp.RightEdgeDistance()") enddef ;
-vardef RightEdgeWidth = runscript("mp.RightEdgeWidth()") enddef ;
-vardef InnerMarginDistance = runscript("mp.InnerMarginDistance()") enddef ;
-vardef InnerMarginWidth = runscript("mp.InnerMarginWidth()") enddef ;
-vardef OuterMarginDistance = runscript("mp.OuterMarginDistance()") enddef ;
-vardef OuterMarginWidth = runscript("mp.OuterMarginWidth()") enddef ;
-vardef InnerEdgeDistance = runscript("mp.InnerEdgeDistance()") enddef ;
-vardef InnerEdgeWidth = runscript("mp.InnerEdgeWidth()") enddef ;
-vardef OuterEdgeDistance = runscript("mp.OuterEdgeDistance()") enddef ;
-vardef OuterEdgeWidth = runscript("mp.OuterEdgeWidth()") enddef ;
-vardef PageOffset = runscript("mp.PageOffset()") enddef ;
-vardef PageDepth = runscript("mp.PageDepth()") enddef ;
-vardef LayoutColumns = runscript("mp.LayoutColumns()") enddef ;
-vardef LayoutColumnDistance = runscript("mp.LayoutColumnDistance()") enddef ;
-vardef LayoutColumnWidth = runscript("mp.LayoutColumnWidth()") enddef ;
-
-vardef OnRightPage = runscript("mp.OnRightPage()") enddef ;
-vardef OnOddPage = runscript("mp.OnOddPage()") enddef ;
-vardef InPageBody = runscript("mp.InPageBody()") enddef ;
-
-vardef RealPageNumber = runscript("mp.RealPageNumber()") enddef ;
-vardef LastPageNumber = runscript("mp.LastPageNumber()") enddef ; % duplicates
-
-vardef PageNumber = runscript("mp.PageNumber()") enddef ;
-vardef NOfPages = runscript("mp.NOfPages()") enddef ;
-
-vardef SubPageNumber = runscript("mp.SubPageNumber()") enddef ;
-vardef NOfSubPages = runscript("mp.NOfSubPages()") enddef ;
-
-vardef CurrentColumn = runscript("mp.CurrentColumn()") enddef ;
-vardef NOfColumns = runscript("mp.NOfColumns()") enddef ;
-
-vardef BaseLineSkip = runscript("mp.BaseLineSkip()") enddef ;
-vardef LineHeight = runscript("mp.LineHeight()") enddef ;
-vardef BodyFontSize = runscript("mp.BodyFontSize()") enddef ;
-
-vardef TopSkip = runscript("mp.TopSkip()") enddef ;
-vardef StrutHeight = runscript("mp.StrutHeight()") enddef ;
-vardef StrutDepth = runscript("mp.StrutDepth()") enddef ;
-
-vardef CurrentWidth = runscript("mp.CurrentWidth()") enddef ;
-vardef CurrentHeight = runscript("mp.CurrentHeight()") enddef ;
-
-vardef HSize = runscript("mp.HSize()") enddef ; % duplicates
-vardef VSize = runscript("mp.VSize()") enddef ; % duplicates
-
-vardef EmWidth = runscript("mp.EmWidth()") enddef ;
-vardef ExHeight = runscript("mp.ExHeight()") enddef ;
-
-vardef PageFraction = runscript("mp.PageFraction()") enddef ;
-
-vardef SpineWidth = runscript("mp.SpineWidth()") enddef ;
-vardef PaperBleed = runscript("mp.PaperBleed()") enddef ;
-
-boolean mfun_swapped ;
-
-def SwapPageState =
- mfun_swapped := true ; % eventually this will go !
-enddef ;
-
-extra_beginfig := extra_beginfig & "mfun_swapped := false ;" ;
-
-vardef LeftMarginWidth = if mfun_swapped and not OnRightPage : runscript("mp.RightMarginWidth()") else : runscript("mp.LeftMarginWidth()") fi enddef ;
-vardef RightMarginWidth = if mfun_swapped and not OnRightPage : runscript("mp.LeftMarginWidth()") else : runscript("mp.RightMarginWidth()") fi enddef ;
-vardef LeftMarginDistance = if mfun_swapped and not OnRightPage : runscript("mp.RightMarginDistance()") else : runscript("mp.LeftMarginDistance()") fi enddef ;
-vardef RightMarginDistance = if mfun_swapped and not OnRightPage : runscript("mp.LeftMarginDistance()") else : runscript("mp.RightMarginDistance()") fi enddef ;
-
-vardef LeftEdgeWidth = if mfun_swapped and not OnRightPage : runscript("mp.RightEdgeWidth()") else : runscript("mp.LeftEdgeWidth()") fi enddef ;
-vardef RightEdgeWidth = if mfun_swapped and not OnRightPage : runscript("mp.LeftEdgeWidth()") else : runscript("mp.RightEdgeWidth()") fi enddef ;
-vardef LeftEdgeDistance = if mfun_swapped and not OnRightPage : runscript("mp.RightEdgeDistance()") else : runscript("mp.LeftEdgeDistance()") fi enddef ;
-vardef RightEdgeDistance = if mfun_swapped and not OnRightPage : runscript("mp.LeftEdgeDistance()") else : runscript("mp.RightEdgeDistance()") fi enddef ;
-
-vardef BackSpace = if mfun_swapped and not OnRightPage : PaperWidth - MakeupWidth - fi runscript("mp.BackSpace()") enddef ;
-vardef CutSpace = if mfun_swapped and not OnRightPage : PaperWidth - MakeupWidth - fi runscript("mp.CutSpace()") enddef ;
-
-% better use:
-
-vardef OuterMarginWidth = if not OnRightPage : runscript("mp.LeftMarginWidth()") else : runscript("mp.RightMarginWidth()") fi enddef ;
-vardef InnerMarginWidth = if not OnRightPage : runscript("mp.RightMarginWidth()") else : runscript("mp.LeftMarginWidth()") fi enddef ;
-vardef OuterMarginDistance = if not OnRightPage : runscript("mp.LeftMarginDistance()") else : runscript("mp.RightMarginDistance()") fi enddef ;
-vardef InnerMarginDistance = if not OnRightPage : runscript("mp.RightMarginDistance()") else : runscript("mp.LeftMarginDistance()") fi enddef ;
-
-vardef OuterEdgeWidth = if not OnRightPage : runscript("mp.LeftEdgeWidth()") else : runscript("mp.RightEdgeWidth()") fi enddef ;
-vardef InnerEdgeWidth = if not OnRightPage : runscript("mp.RightEdgeWidth()") else : runscript("mp.LeftEdgeWidth()") fi enddef ;
-vardef OuterEdgeDistance = if not OnRightPage : runscript("mp.LeftEdgeDistance()") else : runscript("mp.RightEdgeDistance()") fi enddef ;
-vardef InnerEdgeDistance = if not OnRightPage : runscript("mp.RightEdgeDistance()") else : runscript("mp.LeftEdgeDistance()") fi enddef ;
-
-vardef OuterSpaceWidth = if not OnRightPage : runscript("mp.BackSpace()") else : runscript("mp.CutSpace()") fi enddef ;
-vardef InnerSpaceWidth = if not OnRightPage : runscript("mp.CutSpace()") else : runscript("mp.BackSpace()") fi enddef ;
-
-% indices
-
-vardef OuterMargin = if not OnRightPage : LeftMargin else : RightMargin fi enddef ;
-vardef InnerMargin = if not OnRightPage : RightMargin else : LeftMargin fi enddef ;
-
-vardef OuterEdge = if not OnRightPage : LeftEdge else : RightEdge fi enddef ;
-vardef InnerEdge = if not OnRightPage : Rightedge else : LeftEdge fi enddef ;
-
-% vardef CurrentLayout = runscript("mp.CurrentLayout()") enddef ;
-
-vardef OverlayWidth = runscript("mp.OverlayWidth()") enddef ;
-vardef OverlayHeight = runscript("mp.OverlayHeight()") enddef ;
-vardef OverlayDepth = runscript("mp.OverlayDepth()") enddef ;
-vardef OverlayLineWidth = runscript("mp.OverlayLineWidth()") enddef ;
-vardef OverlayOffset = runscript("mp.OverlayOffset()") enddef ;
-vardef OverlayRegion = runscript("mp.OverlayRegion()") enddef ;
-
-vardef defaultcolormodel = runscript("mp.mf_default_color_model()") enddef ;
-
-% def OverlayLineColor = runscript("mp.OverlayLineColor()") enddef ;
-% def OverlayColor = runscript("mp.OverlayColor()") enddef ;
-
% Next we implement the the page area model. First some constants.
LeftEdge := -4 ; Top := -40 ;