From 7d2a3905f254a18a3db438ee93bb7570532cd993 Mon Sep 17 00:00:00 2001
From: Hans Hagen <pragma@wxs.nl>
Date: Mon, 13 Dec 2010 20:58:00 +0100
Subject: beta 2010.12.13 20:58

---
 tex/context/base/cont-new.tex               |  2 +-
 tex/context/base/context.tex                |  2 +-
 tex/context/base/strc-lst.mkiv              | 72 +++++++++++++++++++----------
 tex/context/base/supp-box.lua               | 13 ++----
 tex/generic/context/luatex-fonts-merged.lua |  2 +-
 5 files changed, 55 insertions(+), 36 deletions(-)

(limited to 'tex')

diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 1248d1568..2d46457a9 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-\newcontextversion{2010.12.12 17:06}
+\newcontextversion{2010.12.13 20:58}
 
 %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/context.tex b/tex/context/base/context.tex
index 12939fa64..9065429f9 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
 %D your styles an modules.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2010.12.12 17:06}
+\edef\contextversion{2010.12.13 20:58}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/strc-lst.mkiv b/tex/context/base/strc-lst.mkiv
index 526ed0409..f037ea6ae 100644
--- a/tex/context/base/strc-lst.mkiv
+++ b/tex/context/base/strc-lst.mkiv
@@ -70,9 +70,18 @@
 
 \def\structurelistinject{\dotripleempty\dostructurelistinject}
 
-\def\dostructurelistinject[#1][#2][#3]%
+\def\dostructurelistinject[#1]% [#2][#3]% no check on nofarguments here
   {\begingroup
-   \edef\currentlistname{#1}%
+   \edef\currentlist{#1}%
+   \doifelse{\listparameter\c!state}\v!start\dodostructurelistinject\nonostructurelistinject}
+
+\def\dodostructurelistinject[#1][#2]%
+  {\endgroup}
+
+\def\dodostructurelistinject[#1][#2]%
+  {\getparameters[\??li\??li][\c!type=userdata,\c!location=\v!none,#1]%
+   \edef\currentlisttype    {\@@li@@litype}%
+   \edef\currentlistlocation{\@@li@@lilocation}%
    \setnextinternalreference
    \edef\currentlistnumber{\ctxlua{structures.lists.push{
          references = {
@@ -81,16 +90,15 @@
             section  = structures.sections.currentid(),
         },
         metadata = {
-            kind     = "#2",
-            name     = "\currentlistname",
+            kind     = "\currentlisttype",
+            name     = "\currentlist",
             level    = structures.sections.currentlevel(),
             catcodes = \the\catcodetable,
         },
-        userdata = structures.helpers.touserdata(\!!bs\detokenize{#3}\!!es)
+        userdata = structures.helpers.touserdata(\!!bs\detokenize{#2}\!!es)
    }}}%
-   \edef\structurelistsynchronize{\getvalue{\??li::inject::#2::synchronize}}%
    % we can do the enhance injection at the lua end which saves tokenization and a call
-   \ifx\structurelistsynchronize\v!yes
+   \ifx\currentlistlocation\v!here
      % this injects nodes !
      \expanded{\ctxlatelua{structures.lists.enhance(\currentlistnumber)}}%
      % new from here
@@ -381,23 +389,39 @@
 \let\dowritetolist  \gobblefourarguments
 \let\dodowritetolist\gobblefourarguments
 
-% some day we will have \definestructurelistinjector or maybe just as key in #3
-
-\letvalue{\??li::inject::command::synchronize}\v!no
-\letvalue{\??li::inject::userdata::synchronize}\v!no
-\letvalue{\??li::inject::simple::synchronize}\v!yes
-
-\unexpanded\def\writebetweenlist[#1]#2%
-  {\doif{\namedlistparameter{#1}\c!state}\v!start{\structurelistinject[#1][command][command={#2}]}}
-
-\unexpanded\def\writedatatolist
-  {\dodoubleargument\dowritedatatolist}
-
-\def\dowritedatatolist[#1][#2]%
-  {\doif{\namedlistparameter{#1}\c!state}\v!start{\structurelistinject[#1][userdata][#2]}}
-
-\unexpanded\def\writetolist[#1]#2#3%
-  {\doif{\namedlistparameter{#1}\c!state}\v!start{\structurelistinject[#1][simple][first={#2},second={#3}]}}
+% command  : location=none
+% userdata : location=none
+% simple   : location=here
+
+\unexpanded\def\writebetweenlist{\dodoubleempty   \dowritebetweenlist}
+\unexpanded\def\writedatatolist {\dotripleargument\dowritedatatolist}
+\unexpanded\def\writetolist     {\dodoubleempty   \dowritetolist}
+
+\def\dowritebetweenlist[#1][#2]#3% we can overload location
+  {\doif{\namedlistparameter{#1}\c!state}\v!start
+     {\ifsecondargument
+        \dostructurelistinject[#1][#2,\c!type=command][command={#3}]%
+      \else
+        \dostructurelistinject[#1][\c!type=command][command={#3}]%
+      \fi}}
+
+
+\def\dowritedatatolist[#1][#2][#3]% we can overload location
+  {\doif{\namedlistparameter{#1}\c!state}\v!start
+    {\ifthirdargument
+       \dostructurelistinject[#1][#2,\c!type=userdata][#3]%
+     \else
+       \dostructurelistinject[#1][\c!type=userdata][#2]%
+     \fi}}
+
+
+\def\dowritetolist[#1][#2]#3#4% we can overload location
+  {\doif{\namedlistparameter{#1}\c!state}\v!start
+     {\ifsecondargument
+        \dostructurelistinject[#1][\c!location=\v!here,#2,\c!type=simple][first={#3},second={#4}]%
+      \else
+        \dostructurelistinject[#1][\c!location=\v!here,\c!type=simple][first={#3},second={#4}]%
+      \fi}}
 
 \installstructurelistprocessor{simple}
   {\dodolistelement
diff --git a/tex/context/base/supp-box.lua b/tex/context/base/supp-box.lua
index 6c53a4c5f..c40995562 100644
--- a/tex/context/base/supp-box.lua
+++ b/tex/context/base/supp-box.lua
@@ -24,19 +24,14 @@ local texbox       = tex.box
 
 function hyphenatedlist(list)
     while list do
-        local id = list.id
-        local next = list.next
-        local prev = list.prev
+        local id, next, prev = list.id, list.next, list.prev
         if id == disc_code then
             local hyphen = list.pre
             if hyphen then
                 local penalty = new_penalty(-500)
-                hyphen.next = penalty
-                penalty.prev = hyphen
-                prev.next = hyphen
-                next.prev = penalty
-                penalty.next = next
-                hyphen.prev = prev
+                hyphen.next, penalty.prev = penalty, hyphen
+                prev.next, next.prev = hyphen, penalty
+                penalty.next, hyphen.prev = next, prev
                 list.pre = nil
                 free_node(list)
             end
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 1c692e810..6af528034 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
 -- merged file : luatex-fonts-merged.lua
 -- parent file : luatex-fonts.lua
--- merge date  : 12/12/10 17:06:51
+-- merge date  : 12/13/10 20:58:02
 
 do -- begin closure to overcome local limits and interference
 
-- 
cgit v1.2.3