From a70505be3a0d7fe72fb0e0502a0270f879755851 Mon Sep 17 00:00:00 2001
From: Marius <mariausol@gmail.com>
Date: Tue, 7 Dec 2010 02:00:10 +0200
Subject: beta 2010.12.07 00:30

---
 tex/context/base/cont-new.tex               |  2 +-
 tex/context/base/context.tex                |  2 +-
 tex/context/base/font-fbk.lua               | 10 ++---
 tex/context/base/font-tfm.lua               |  6 +--
 tex/context/base/luat-ini.lua               | 12 +++---
 tex/context/base/s-pre-71.lua               | 63 +++++++++++++++++++++++++++++
 tex/context/base/s-pre-71.mkiv              | 63 +++++------------------------
 tex/context/base/strc-ref.lua               |  4 ++
 tex/context/base/typo-dir.mkiv              |  4 +-
 tex/context/base/x-pending.mkiv             | 39 ------------------
 tex/generic/context/luatex-fonts-merged.lua |  8 ++--
 11 files changed, 97 insertions(+), 116 deletions(-)
 create mode 100644 tex/context/base/s-pre-71.lua
 delete mode 100644 tex/context/base/x-pending.mkiv

diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 0db8439d2..d46a8d45c 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.06 15:24}
+\newcontextversion{2010.12.07 00:30}
 
 %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 302d2f5c8..adb4e1115 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.06 15:24}
+\edef\contextversion{2010.12.07 00:30}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/font-fbk.lua b/tex/context/base/font-fbk.lua
index fca9e5081..0ddee6680 100644
--- a/tex/context/base/font-fbk.lua
+++ b/tex/context/base/font-fbk.lua
@@ -177,16 +177,16 @@ function vf.aux.compose_characters(g) -- todo: scaling depends on call location
                                             t.commands = { push, {"right", dx+dd},                      acc_t,        pop, chr_t }
                                         end
                                     end
-                                    done = true
                                 else
                                     t.commands = { chr_t } -- else index mess
-                                    done = true
                                 end
-                            elseif trace_combining_all then
-                                report_combining("%s (0x%05X) = %s (0x%05X) (simplified)",utfchar(i),i,utfchar(chr),chr)
+                            else
+                                if trace_combining_all then
+                                    report_combining("%s (0x%05X) = %s (0x%05X) (simplified)",utfchar(i),i,utfchar(chr),chr)
+                                end
                                 t.commands = { chr_t } -- else index mess
-                                done = true
                             end
+                            done = true
                             chars[i] = t
                             local d = { }
                             for k, v in next, descs[chr] do
diff --git a/tex/context/base/font-tfm.lua b/tex/context/base/font-tfm.lua
index 1877f08c3..68a92532b 100644
--- a/tex/context/base/font-tfm.lua
+++ b/tex/context/base/font-tfm.lua
@@ -364,10 +364,7 @@ function tfm.scale(tfmtable, scaledpoints, relativeid)
     local sharedkerns = { }
     for k,v in next, characters do
         local chr, description, index
-        if isvirtual then
-            description = descriptions[k] or v
-            -- no index
-        elseif ischanged then
+        if ischanged then
             -- basemode hack
             local c = changed[k]
             if c then
@@ -595,6 +592,7 @@ function tfm.scale(tfmtable, scaledpoints, relativeid)
                 else
                     chr.commands = vc
                 end
+                chr.index = nil
             end
         end
         tc[k] = chr
diff --git a/tex/context/base/luat-ini.lua b/tex/context/base/luat-ini.lua
index 40a49defa..cd79cd492 100644
--- a/tex/context/base/luat-ini.lua
+++ b/tex/context/base/luat-ini.lua
@@ -21,13 +21,13 @@ These can be used for runtime user data or third party modules and will not be
 cluttered by macro package code.</p>
 --ldx]]--
 
-userdata      = userdata      or { } -- might be used
-thirddata     = thirddata     or { } -- might be used
-moduledata    = moduledata    or { } -- might be used
-documentdata  = documentdata  or { } -- might be used
-parametersets = parametersets or { } -- experimental
+userdata      = userdata      or { } -- for users (e.g. functions etc)
+thirddata     = thirddata     or { } -- only for third party modules
+moduledata    = moduledata    or { } -- only for development team
+documentdata  = documentdata  or { } -- for users (e.g. raw data)
+parametersets = parametersets or { } -- experimental for team
 
-document      = document      or { }
+document      = document      or { } -- only for context itself
 
 --[[ldx--
 <p>These can be used/set by the caller program; <t>mtx-context.lua</t> does it.</p>
diff --git a/tex/context/base/s-pre-71.lua b/tex/context/base/s-pre-71.lua
new file mode 100644
index 000000000..bfa45a705
--- /dev/null
+++ b/tex/context/base/s-pre-71.lua
@@ -0,0 +1,63 @@
+if not modules then modules = { } end modules ['steps'] = {
+    version   = 1.001,
+    comment   = "companion to steps.mkiv",
+    author    = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+    copyright = "PRAGMA ADE / ConTeXt Development Team",
+    license   = "see context related readme files"
+}
+
+moduledata.steps = moduledata.steps or { }
+local steps      = moduledata.steps
+
+local locations = {
+    'lefttop',
+    'middletop',
+    'righttop',
+    'middleleft',
+    'middle',
+    'middleright',
+    'leftbottom',
+    'middlebottom',
+    'rightbottom',
+}
+
+local done, current, previous, n
+
+function steps.reset_locations()
+    done, current, previous, n = table.tohash(locations,false), 0, 0, 0
+end
+
+function steps.next_location(loc)
+    previous = current
+    n = n + 1
+    loc = loc and loc ~= "" and tonumber(loc)
+    while true do
+        current = loc or math.random(1,#locations)
+        if not done[current] then
+            done[current] = true
+            break
+        end
+    end
+end
+
+function steps.current_location()
+    context(locations[current] or "")
+end
+
+function steps.previous_location()
+    context(locations[previous] or "")
+end
+
+function steps.current_n()
+    context(current)
+end
+
+function steps.previous_n()
+    context(previous)
+end
+
+function steps.step()
+    context(n)
+end
+
+steps.reset_locations()
diff --git a/tex/context/base/s-pre-71.mkiv b/tex/context/base/s-pre-71.mkiv
index a23d1950f..69280243b 100644
--- a/tex/context/base/s-pre-71.mkiv
+++ b/tex/context/base/s-pre-71.mkiv
@@ -20,6 +20,8 @@
 
 \usemodule[pre-60,abr-02]
 
+\registerctxluafile{s-pre-71}{}
+
 \setupinteraction[state=start,click=off]
 
 \definepapersize[wide][width=900pt,height=600pt]
@@ -60,54 +62,9 @@
 \setupcolors[state=start]
 \setupcolors[textcolor=TopicColor]
 
-\startluacode
-    local locations = {
-        'lefttop',
-        'middletop',
-        'righttop',
-        'middleleft',
-        'middle',
-        'middleright',
-        'leftbottom',
-        'middlebottom',
-        'rightbottom',
-    }
-    local done, current, previous, n = table.tohash(locations,false), 0, 0, 0
-    function document.reset_locations()
-        done, current, previous, n = table.tohash(locations,false), 0, 0, 0
-    end
-    function document.next_location(loc)
-        previous = current
-        n = n + 1
-        loc = loc and loc ~= "" and tonumber(loc)
-        while true do
-            current = loc or math.random(1,#locations)
-            if not done[current] then
-                done[current] = true
-                break
-            end
-        end
-    end
-    function document.current_location()
-        tex.print(locations[current] or "")
-    end
-    function document.previous_location()
-        tex.print(locations[previous] or "")
-    end
-    function document.current_n()
-        tex.print(tostring(current))
-    end
-    function document.previous_n()
-        tex.print(tostring(previous))
-    end
-    function document.step()
-        tex.print(tostring(n))
-    end
-\stopluacode
-
 \def\StartTopics
   {\startstandardmakeup
-   \ctxlua{document.reset_locations()}
+   \ctxlua{moduledata.steps.reset_locations()}
    \doifnotmode{paper}{\StartLocalSteps}}
 
 \def\StopTopics
@@ -120,13 +77,13 @@
 
 \def\doStartTopic[#1]%
   {\doifnotmode{paper}{\NextStep}
-   \ctxlua{document.next_location("#1")}
+   \ctxlua{moduledata.steps.next_location("#1")}
    \startnotmode[paper]
      \doifnothing{#1}
-       {\ifcase\ctxlua{document.previous_n()}\else
+       {\ifcase\ctxlua{moduledata.steps.previous_n()}\else
           \setlayer
             [page]
-            [preset=\ctxlua{document.previous_location()}]
+            [preset=\ctxlua{moduledata.steps.previous_location()}]
              \bgroup
                \doifnotmode{paper}{\startviewerlayer[\StepLayer]}%
                \framed
@@ -145,7 +102,7 @@
    \stopnotmode
    \setlayer
      [page]
-     [preset=\ctxlua{document.current_location()}]
+     [preset=\ctxlua{moduledata.steps.current_location()}]
      \bgroup
        \doifnotmode{paper}{\startviewerlayer[\StepLayer]}%
        \framed
@@ -157,7 +114,7 @@
           height=\dimexpr\paperheight/3\relax,
           width=\dimexpr\paperwidth/3\relax,
           background=color,
-          backgroundcolor=TopicColor-\ctxlua{document.current_n()}]
+          backgroundcolor=TopicColor-\ctxlua{moduledata.steps.current_n()}]
          \bgroup
          \ignorespaces}
 
@@ -169,14 +126,14 @@
    \startmode[numbers]
    \setlayerframed
      [page]
-     [preset=\ctxlua{document.current_location()}]
+     [preset=\ctxlua{moduledata.steps.current_location()}]
      [height=\dimexpr\paperheight/3\relax,
       width=\dimexpr\paperwidth/3\relax,
       frame=off,
       foregroundstyle=\bfa,
       align={flushright,low}]
      {\doifnotmode{paper}{\startviewerlayer[\StepLayer]}%
-      \ctxlua{document.step()}\kern\strutdepth
+      \ctxlua{moduledata.steps.step()}\kern\strutdepth
       \doifnotmode{paper}{\stopviewerlayer}}
    \stopmode}
 
diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua
index c380fb4ea..39b0d9f0c 100644
--- a/tex/context/base/strc-ref.lua
+++ b/tex/context/base/strc-ref.lua
@@ -347,15 +347,19 @@ function references.urls.define(name,url,file,description)
     end
 end
 
+local pushcatcodes, popcatcodes, txtcatcodes = context.pushcatcodes, context.popcatcodes, tex.txtcatcodes
+
 function references.urls.get(name,method,space) -- method: none, before, after, both, space: yes/no
     local u = urls[name]
     if u then
         local url, file = u[1], u[2]
+        pushcatcodes(txtcatcodes)
         if file and file ~= "" then
             context("%s/%s",url,file)
         else
             context(url)
         end
+        popcatcodes()
     end
 end
 
diff --git a/tex/context/base/typo-dir.mkiv b/tex/context/base/typo-dir.mkiv
index 5487e7979..b4e7cb67f 100644
--- a/tex/context/base/typo-dir.mkiv
+++ b/tex/context/base/typo-dir.mkiv
@@ -89,7 +89,7 @@
 \def\ARAB {محمد}
 
 \startluacode
-    function document.split_tokens(str)
+    function documentdata.split_tokens(str)
         for s in str:bytes() do
             tex.sprint(tex.ctxcatcodes,string.format("\\hbox{\\char %s}",s))
         end
@@ -102,7 +102,7 @@
      \enabletrackers[typesetters.directions]%
      \framed[offset=overlay]{#1#3}\quad
      \disabletrackers[typesetters.directions]%
-     \tttf\ctxlua{document.split_tokens([[\detokenize{#3}]])}}}
+     \tttf\ctxlua{documentdata.split_tokens([[\detokenize{#3}]])}}}
 
 \startbuffer[bidi-sample]
 \biditest\Arabic{LATIN BARA}{\textdir TLT\relax   \LATIN\ \ARAB}\par
diff --git a/tex/context/base/x-pending.mkiv b/tex/context/base/x-pending.mkiv
deleted file mode 100644
index fa4cd18de..000000000
--- a/tex/context/base/x-pending.mkiv
+++ /dev/null
@@ -1,39 +0,0 @@
-%D \module
-%D   [      file=x-pending,
-%D        version=2008.04.04,
-%D          title=\CONTEXT\ Style File,
-%D       subtitle=Track \MKII\ \XML\ usage in \MKIV,
-%D         author=Hans Hagen,
-%D           date=\currentdate,
-%D      copyright={PRAGMA / Hans Hagen \& Ton Otten}]
-%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 Including this module will result in the production of
-%D a file \type {jobname-pending-xml.log} which has a
-%D \LUA\ table with \XML\ elements that are still catched by
-%D \MKII\ code, when enabled.
-
-\startluacode
-    dofile(resolvers.findfile("lxml-inf.lua"))
-    local list = { }
-    function document.check_pending_xml_element(str)
-        list[str] = (list[str] and (list[str]+1)) or 1
-    end
-    function document.show_pending_xml_elements()
-        io.savedata("\jobname-pending-xml-mkii.log", table.serialize(list))
-        io.savedata("\jobname-pending-xml-mkiv.log", table.serialize(lxml.get_command_status()))
-    end
-\stopluacode
-
-\defineXMLcommand
-  [default]
-  {\ctxlua{document.check_pending_xml_element("\currentXMLelement")}}
-
-\appendtoks
-    \ctxlua{document.show_pending_xml_elements()}%
-\to \everystoptext
-
-\endinput
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 268498c32..3595a58b5 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/06/10 15:24:44
+-- merge date  : 12/07/10 00:30:35
 
 do -- begin closure to overcome local limits and interference
 
@@ -3780,10 +3780,7 @@ function tfm.scale(tfmtable, scaledpoints, relativeid)
     local sharedkerns = { }
     for k,v in next, characters do
         local chr, description, index
-        if isvirtual then
-            description = descriptions[k] or v
-            -- no index
-        elseif ischanged then
+        if ischanged then
             -- basemode hack
             local c = changed[k]
             if c then
@@ -4011,6 +4008,7 @@ function tfm.scale(tfmtable, scaledpoints, relativeid)
                 else
                     chr.commands = vc
                 end
+                chr.index = nil
             end
         end
         tc[k] = chr
-- 
cgit v1.2.3