From d322e17a5a4225a54f7653abb7b52e24fbbdbdf8 Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Thu, 5 Jan 2012 19:27:47 +0100
Subject: beta 2011.12.19 01:47

---
 tex/context/base/anch-pgr.mkiv       |  47 +++++++++++++++++++----------------
 tex/context/base/anch-pos.lua        |  12 ++-------
 tex/context/base/context-version.pdf | Bin 4071 -> 4069 bytes
 tex/context/base/context-version.png | Bin 106448 -> 104792 bytes
 tex/context/base/pack-box.mkiv       |   8 ++----
 tex/context/base/status-files.pdf    | Bin 23978 -> 23976 bytes
 tex/context/base/status-lua.pdf      | Bin 169719 -> 169720 bytes
 tex/context/base/supp-box.mkiv       |  45 ++++++++++++++++++++++++++-------
 8 files changed, 66 insertions(+), 46 deletions(-)

(limited to 'tex')

diff --git a/tex/context/base/anch-pgr.mkiv b/tex/context/base/anch-pgr.mkiv
index d957bb6dd..4a9bf6ee3 100644
--- a/tex/context/base/anch-pgr.mkiv
+++ b/tex/context/base/anch-pgr.mkiv
@@ -41,7 +41,7 @@
 %D Anchors:
 
 \def\dopresetpositionanchors % also mkii
-  {\bgroup
+  {\begingroup
    \!!dimena\ifdim\topskip>\strutht\topskip\else\strutht\fi
    \!!dimenb\dimexpr\MPy\textanchor+\MPh\textanchor-\!!dimena\relax
    \!!dimenc\dimexpr\MPy\textanchor+\strutdp\relax
@@ -49,7 +49,7 @@
    \!!dimene\MPw\textanchor
    \replacepospxywhd\headanchor\realfolio\!!dimend\!!dimenb\!!dimene\!!dimena\strutdp
    \replacepospxywhd\tailanchor\realfolio\!!dimend\!!dimenc\!!dimene\strutht \strutdp
-   \egroup}
+   \endgroup}
 
 \def\presetpositionanchors% compatibility hack (still needed?)
   {\ifpositioning
@@ -167,28 +167,33 @@
 
 \let\MPanchornumber\realfolio
 
-\def\positionoverlay#1% the test prevents too many redundant positions
+\def\positionoverlay  % the test prevents too many redundant positions
   {\ifpositioning     % in (not used) text* position layers
-     \vbox to \overlayheight
-       {\doifpositionactionelse{#1::\MPanchoridentifier}%
-          {\edef\MPanchorid{#1::\MPanchoridentifier:\MPanchornumber}%
-           \edef\MPanchor##1{\MPpos{\MPanchorid}}%
-           \the\everyinsertpositionaction
-           \copyposition{#1::\MPanchoridentifier}{#1::\MPanchoridentifier:\MPanchornumber}%
-           \hpos
-             {#1::\MPanchoridentifier:\MPanchornumber}%
-            % this is ok
-            %{\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}}}%
-            % but this one prevents cyclic runs due to
-            % rounding errors
-             {\setbox\scratchbox\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}%
-              \ht\scratchbox\overlayheight
-              \dp\scratchbox\zeropoint
-              \box\scratchbox}}%
-          {\hbox to \overlaywidth{\hss}}%
-        \vfill}%
+     \expandafter\positionoverlayindeed
+   \else % also \iftrialtypesetting test here?
+     \expandafter\gobbleoneargument
    \fi}
 
+\def\positionoverlayindeed#1% the test prevents too many redundant positions
+  {\vbox to \overlayheight
+     {\doifpositionactionelse{#1::\MPanchoridentifier}%
+        {\edef\MPanchorid{#1::\MPanchoridentifier:\MPanchornumber}%
+         \edef\MPanchor##1{\MPpos{\MPanchorid}}%
+         \the\everyinsertpositionaction
+         \copyposition{#1::\MPanchoridentifier}{#1::\MPanchoridentifier:\MPanchornumber}%
+         \hpos
+           {#1::\MPanchoridentifier:\MPanchornumber}%
+          % this is ok
+          %{\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}}}%
+          % but this one prevents cyclic runs due to
+          % rounding errors
+           {\setbox\scratchbox\hbox to \overlaywidth{\dopositionaction{#1::\MPanchoridentifier}\hss}%
+            \ht\scratchbox\overlayheight
+            \dp\scratchbox\zeropoint
+            \box\scratchbox}}%
+        {\hbox to \overlaywidth{\hss}}%
+      \vfill}}
+
 \unexpanded\def\startpositionoverlay#1%
   {\iftrialtypesetting % we don't want redundant entries in the list
      \@EA\gobbleuntil\@EA\stoppositionoverlay
diff --git a/tex/context/base/anch-pos.lua b/tex/context/base/anch-pos.lua
index 34fc46209..bd766fa2b 100644
--- a/tex/context/base/anch-pos.lua
+++ b/tex/context/base/anch-pos.lua
@@ -87,20 +87,12 @@ end
 
 function jobpositions.page(id)
     local jpi = collected[id] or tobesaved[id]
-    if jpi then
-        return jpi[1]
-    else
-        return 0
-    end
+    return jpi and jpi[1] or 0
 end
 
 function jobpositions.x(id)
     local jpi = collected[id] or tobesaved[id]
-    if jpi then
-        return jpi[2]
-    else
-        return 0
-    end
+    return jpi and jpi[2] or 0
 end
 
 function jobpositions.y(id)
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index f1a7d7efe..7307dd017 100644
Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 5e89d54f7..2b2d5e9f0 100644
Binary files a/tex/context/base/context-version.png and b/tex/context/base/context-version.png differ
diff --git a/tex/context/base/pack-box.mkiv b/tex/context/base/pack-box.mkiv
index 7469a55f8..90abcf497 100644
--- a/tex/context/base/pack-box.mkiv
+++ b/tex/context/base/pack-box.mkiv
@@ -37,14 +37,10 @@
 
 \def\internaltextoverlay#1% will become more generic and installable
   {\startoverlay          % i.e. probably an overlay by itself
-     {\positionoverlay{\v!text#1}} % see later
-     {\composedlayer  {\v!text#1}}
+     {\positionoverlay{\v!text#1}}% see later
+     {\composedlayer  {\v!text#1}}%
    \stopoverlay}
 
-%\def\internaltextoverlay#1%
-%  {\hbox to \zeropoint{\positionoverlay{\v!tekst#1}\hss}%
-%   \composedlayer{\v!tekst#1}}
-
 % todo: share info, so that tuo will be smaller
 
 \defineoverlay[\v!text-2][\internaltextoverlay{-2}]
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 47193ae79..ccf9141f5 100644
Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index fa85f0670..385b4ccb3 100644
Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ
diff --git a/tex/context/base/supp-box.mkiv b/tex/context/base/supp-box.mkiv
index 40aec18e0..55a0a10b0 100644
--- a/tex/context/base/supp-box.mkiv
+++ b/tex/context/base/supp-box.mkiv
@@ -1843,20 +1843,47 @@
 %D The next macro gobble boxes and is for instance used for
 %D overlays. First we show the general handler.
 
+% we cannot use \futurelet here as we want to skip spaces between
+% boxes (see startoverlay for an example usage)
+
+% \newbox\processbox % public : this is the one where \nextbox's end up in
+%
+% \unexpanded\def\processboxes#1%
+%   {\bgroup
+%    \def\boxes_process_indeed{#1}% #1 can be redefined halfway
+%    \setbox\processbox\emptybox
+%    \afterassignment\boxes_process
+%    \let\nexttoken}
+%
+% \def\boxes_process
+%   {\ifx\nexttoken\bgroup
+%      \expandafter\boxes_process_yes
+%    \else
+%      \expandafter\boxes_process_nop
+%    \fi}
+%
+% \def\boxes_process_yes
+%   {\dowithnextboxcs\boxes_process_content\normalhbox\bgroup}
+%
+% \def\boxes_process_content
+%   {\removeunwantedspaces
+%    \boxes_process_indeed % takes \nextbox makes \processbox
+%    \afterassignment\boxes_process
+%    \let\nexttoken}
+%
+% \unexpanded\def\boxes_process_nop
+%   {\removeunwantedspaces
+%    \box\processbox
+%    \nexttoken % messy as we are still in the group
+%    \egroup}
+
 \newbox\processbox % public : this is the one where \nextbox's end up in
 
 \unexpanded\def\processboxes#1%
   {\bgroup
    \def\boxes_process_indeed{#1}% #1 can be redefined halfway
    \setbox\processbox\emptybox
-   \futurelet\nexttoken\boxes_process}
-
-\def\boxes_process
-  {\ifx\nexttoken\bgroup
-     \expandafter\boxes_process_yes
-   \else
-     \expandafter\boxes_process_nop
-   \fi}
+   \doifnextbgroupelse\boxes_process_yes\boxes_process_nop}
 
 \def\boxes_process_yes
   {\dowithnextboxcs\boxes_process_content\normalhbox}
@@ -1864,7 +1891,7 @@
 \def\boxes_process_content
   {\removeunwantedspaces
    \boxes_process_indeed % takes \nextbox makes \processbox
-   \futurelet\nexttoken\boxes_process}
+   \doifnextbgroupelse\boxes_process_yes\boxes_process_nop}
 
 \unexpanded\def\boxes_process_nop
   {\removeunwantedspaces
-- 
cgit v1.2.3