From 91ce58955fb4a72b4ba6ae39847c21e1e3d261e8 Mon Sep 17 00:00:00 2001
From: Marius <mariausol@gmail.com>
Date: Sun, 17 Mar 2013 14:40:16 +0200
Subject: beta 2013.03.17 13:31

---
 tex/context/base/cont-new.mkii                     |   2 +-
 tex/context/base/cont-new.mkiv                     |   2 +-
 tex/context/base/context-version.pdf               | Bin 4136 -> 4134 bytes
 tex/context/base/context-version.png               | Bin 40527 -> 40468 bytes
 tex/context/base/context.mkii                      |   2 +-
 tex/context/base/context.mkiv                      |   2 +-
 tex/context/base/font-con.lua                      |   4 --
 tex/context/base/font-ctx.lua                      |  38 ++++++------
 tex/context/base/font-otd.lua                      |  15 ++---
 tex/context/base/font-sol.lua                      |  13 +---
 tex/context/base/lang-ini.lua                      |  69 ++-------------------
 tex/context/base/luat-sto.lua                      |   3 -
 tex/context/base/scrn-ini.lua                      |   2 +
 tex/context/base/scrp-ini.lua                      |   2 +-
 tex/context/base/status-files.pdf                  | Bin 24766 -> 24753 bytes
 tex/context/base/status-lua.pdf                    | Bin 210759 -> 210779 bytes
 tex/generic/context/luatex/luatex-fonts-merged.lua |   5 +-
 17 files changed, 39 insertions(+), 120 deletions(-)

(limited to 'tex')

diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index daa376384..98d024fe4 100644
--- a/tex/context/base/cont-new.mkii
+++ b/tex/context/base/cont-new.mkii
@@ -11,7 +11,7 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-\newcontextversion{2013.03.16 22:44}
+\newcontextversion{2013.03.17 13:31}
 
 %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/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 131e8b5ac..4fa32e48d 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,7 +11,7 @@
 %C therefore copyrighted by \PRAGMA. See mreadme.pdf for
 %C details.
 
-\newcontextversion{2013.03.16 22:44}
+\newcontextversion{2013.03.17 13:31}
 
 %D This file is loaded at runtime, thereby providing an excellent place for
 %D hacks, patches, extensions and new features.
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index b5354d291..0143ce463 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 6d0337de0..2aafefe63 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/context.mkii b/tex/context/base/context.mkii
index 7bff5e943..eac5a33ae 100644
--- a/tex/context/base/context.mkii
+++ b/tex/context/base/context.mkii
@@ -20,7 +20,7 @@
 %D your styles an modules.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2013.03.16 22:44}
+\edef\contextversion{2013.03.17 13:31}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index 63e848a76..b33b02fa4 100644
--- a/tex/context/base/context.mkiv
+++ b/tex/context/base/context.mkiv
@@ -25,7 +25,7 @@
 %D up and the dependencies are more consistent.
 
 \edef\contextformat {\jobname}
-\edef\contextversion{2013.03.16 22:44}
+\edef\contextversion{2013.03.17 13:31}
 
 %D For those who want to use this:
 
diff --git a/tex/context/base/font-con.lua b/tex/context/base/font-con.lua
index fc687ea58..618bc8f28 100644
--- a/tex/context/base/font-con.lua
+++ b/tex/context/base/font-con.lua
@@ -31,10 +31,6 @@ fonts.constructors           = constructors
 local handlers               = fonts.handlers or { } -- can have preloaded tables
 fonts.handlers               = handlers
 
-local specifiers             = fonts.specifiers
-local contextsetups          = specifiers.contextsetups
-local contextnumbers         = specifiers.contextnumbers
-
 local allocate               = utilities.storage.allocate
 local setmetatableindex      = table.setmetatableindex
 
diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua
index ca146b39e..ea4418fef 100644
--- a/tex/context/base/font-ctx.lua
+++ b/tex/context/base/font-ctx.lua
@@ -21,7 +21,7 @@ local sortedhash, sortedkeys, sequenced = table.sortedhash, table.sortedkeys, ta
 local settings_to_hash, hash_to_string = utilities.parsers.settings_to_hash, utilities.parsers.hash_to_string
 local formatcolumns = utilities.formatters.formatcolumns
 
-local tostring, next, type = tostring, next, type
+local tostring, next, type, rawget = tostring, next, type, rawget
 local utfchar, utfbyte = utf.char, utf.byte
 local round = math.round
 
@@ -91,23 +91,28 @@ storage.register("fonts/numbers",  numbers,  "fonts.specifiers.contextnumbers")
 storage.register("fonts/merged",   merged,   "fonts.specifiers.contextmerged")
 storage.register("fonts/synonyms", synonyms, "fonts.specifiers.synonyms")
 
--- todo: put numbers also in setups .. we only need those at runtime anyway
+-- inspect(setups)
 
--- if not environment.initex then
---     for i=1,#numbers do
---         setups[i] = setups[numbers[i]]
---     end
--- end
+if environment.initex then
+    setmetatableindex(setups,function(t,k)
+        return type(k) == "number" and rawget(t,numbers[k]) or nil
+    end)
+else
+    setmetatableindex(setups,function(t,k)
+        local v = type(k) == "number" and rawget(t,numbers[k])
+        if v then
+            t[k] = v
+            return v
+        end
+    end)
+end
 
-utilities.strings.formatters.add(string.formatters,
-    "font:name",
-    [["'"..file.basename(%s.properties.name).."'"]]
-)
+-- this will move elsewhere ...
 
-utilities.strings.formatters.add(string.formatters,
-    "font:features",
-    [["'"..table.sequenced(%s," ",true).."'"]]
-)
+utilities.strings.formatters.add(string.formatters,"font:name",    [["'"..file.basename(%s.properties.name).."'"]])
+utilities.strings.formatters.add(string.formatters,"font:features",[["'"..table.sequenced(%s," ",true).."'"]])
+
+-- ... like font-sfm or so
 
 constructors.resolvevirtualtoo = true -- context specific (due to resolver)
 
@@ -371,9 +376,6 @@ local function definecontext(name,t) -- can be shared
     end
     t.number = number
     setups[name] = t
---     if not environment.initex then
---         setups[number] = t
---     end
     return number, t
 end
 
diff --git a/tex/context/base/font-otd.lua b/tex/context/base/font-otd.lua
index fceb0cf01..8a41ebcdb 100644
--- a/tex/context/base/font-otd.lua
+++ b/tex/context/base/font-otd.lua
@@ -45,7 +45,8 @@ local a_to_language      = { }
 -- we can have a scripts hash in fonts.hashes
 
 function otf.setdynamics(font,attribute)
-    local features = contextsetups[contextnumbers[attribute]] -- can be moved to caller
+ -- local features = contextsetups[contextnumbers[attribute]] -- can be moved to caller
+    local features = contextsetups[attribute]
     if features then
         local dynamics = fontdynamics[font]
         dynamic = contextmerged[attribute] or 0
@@ -184,14 +185,6 @@ local function initialize(sequence,script,language,s_enabled,a_enabled,font,attr
     end
 end
 
--- local contextresolved = { }
---
--- setmetatableindex(contextresolved, function(t,k)
---     local v = contextsetups[contextnumbers[k]]
---     t[k] = v
---     return v
--- end)
-
 -- there is some fuzzy language/script state stuff in properties (temporary)
 
 function otf.dataset(tfmdata,font,attr) -- attr only when explicit (as in special parbuilder)
@@ -200,8 +193,8 @@ function otf.dataset(tfmdata,font,attr) -- attr only when explicit (as in specia
 
     if attr and attr ~= 0 then
         dynamic = contextmerged[attr] or 0
-        local features = contextsetups[contextnumbers[attr]] -- could be a direct list
-     -- local features = contextresolved[attr]
+     -- local features = contextsetups[contextnumbers[attr]] -- could be a direct list
+        local features = contextsetups[attr]
         a_enabled = features -- location based
         if dynamic == 1 then -- or dynamic == -1 then
             -- replace
diff --git a/tex/context/base/font-sol.lua b/tex/context/base/font-sol.lua
index 3114e3847..db2dd24c2 100644
--- a/tex/context/base/font-sol.lua
+++ b/tex/context/base/font-sol.lua
@@ -215,7 +215,7 @@ local function convert(featuresets,name,list)
                     report_solutions("solution %a of %a uses feature %a with number %s",i,name,feature,fn)
                 end
             else
-                report_solutions("solution %a has an invalid feature reference %a",i,name,tostring(feature))
+                report_solutions("solution %a of %a has an invalid feature reference %a",i,name,feature)
             end
         end
         return nofnumbers > 0 and numbers
@@ -569,17 +569,6 @@ local function doit(word,list,best,width,badness,line,set,listdir)
                     end
                 end
                 local font = found.font
-             -- local dynamics = found.dynamics
-             -- local shared = fontdata[font].shared
-             -- if not dynamics then -- we cache this
-             --     dynamics = shared.dynamics
-             --     found.dynamics = dynamics
-             -- end
-             -- local processors = found[featurenumber]
-             -- if not processors then -- we cache this too
-             --     processors = fonts.handlers.otf.setdynamics(font,featurenumber)
-             --     found[featurenumber] = processors
-             -- end
                 local setdynamics = setfontdynamics[font]
                 if setdynamics then
                     local processes = setdynamics(font,featurenumber)
diff --git a/tex/context/base/lang-ini.lua b/tex/context/base/lang-ini.lua
index 771a502e4..4ae7656d3 100644
--- a/tex/context/base/lang-ini.lua
+++ b/tex/context/base/lang-ini.lua
@@ -88,7 +88,8 @@ end
 
 -- languages.tolang = tolang
 
--- todo: en+de => merge
+-- patterns=en
+-- patterns=en,de
 
 local function loaddefinitions(tag,specification)
     statistics.starttiming(languages)
@@ -300,9 +301,9 @@ function languages.hyphenate(tag,str)
     end
 end
 
---~ hyphenation.define        ("zerolanguage")
---~ hyphenation.loadpatterns  ("zerolanguage") -- else bug
---~ hyphenation.loadexceptions("zerolanguage") -- else bug
+-- hyphenation.define        ("zerolanguage")
+-- hyphenation.loadpatterns  ("zerolanguage") -- else bug
+-- hyphenation.loadexceptions("zerolanguage") -- else bug
 
 languages.logger = languages.logger or { }
 
@@ -317,7 +318,7 @@ function languages.logger.report()
     return r > 0 and concat(result," ") or "none"
 end
 
--- must happen at the tex end
+-- must happen at the tex end .. will use lang-def.lua
 
 languages.associate('en','latn','eng')
 languages.associate('uk','latn','eng')
@@ -336,64 +337,6 @@ statistics.register("language load time", function()
     return statistics.elapsedseconds(languages, format(", nofpatterns: %s",nofloaded))
 end)
 
---~ -- obsolete
---~ --
---~ -- loading the 26 languages that we normally load in mkiv, the string based variant
---~ -- takes .84 seconds (probably due to the sub's) while the lpeg variant takes .78
---~ -- seconds
---~ --
---~ -- the following lpeg can probably be improved (it was one of the first I made)
-
---~ local leftbrace  = lpeg.P("{")
---~ local rightbrace = lpeg.P("}")
---~ local spaces     = lpeg.S(" \r\n\t\f")
---~ local spacing    = spaces^0
---~ local validchar  = 1-(spaces+rightbrace+leftbrace)
---~ local validword  = validchar^1
---~ local content    = spacing * leftbrace * spacing * lpeg.C((spacing * validword)^0) * spacing * rightbrace * lpeg.P(true)
---~
---~ local command    = lpeg.P("\\patterns")
---~ local parser     = (1-command)^0 * command * content
---~
---~ local function filterpatterns(filename)
---~     return lpegmatch(parser,io.loaddata(resolvers.findfile(filename)) or "")
---~ end
---~
---~ local command = lpeg.P("\\hyphenation")
---~ local parser  = (1-command)^0 * command * content
---~
---~ local function filterexceptions(filename)
---~     return lpegmatch(parser,io.loaddata(resolvers.findfile(filename)) or "") -- "" ?
---~ end
---~
---~ local function loadthem(tag, filename, filter, target)
---~     statistics.starttiming(languages)
---~     local data, instance = resolve(tag)
---~     local fullname = (filename and filename ~= "" and resolvers.findfile(filename)) or ""
---~     local ok = fullname ~= ""
---~     if ok then
---~         if trace_patterns then
---~             report_initialization("filtering %s for language %a from %a",target,tag,fullname)
---~         end
---~         lang[target](data,filter(fullname) or "")
---~     else
---~         if trace_patterns then
---~             report_initialization("no %s for language %a in %a",target,tag,filename)
---~         end
---~         lang[target](instance,"")
---~     end
---~     statistics.stoptiming(languages)
---~     return ok
---~ end
---~
---~ function hyphenation.loadpatterns(tag, patterns)
---~     return loadthem(tag, patterns, filterpatterns, "patterns")
---~ end
---~
---~ function hyphenation.loadexceptions(tag, exceptions)
---~     return loadthem(tag, exceptions, filterexceptions, "exceptions")
---~ end
-
 -- interface
 
 local getnumber = languages.getnumber
diff --git a/tex/context/base/luat-sto.lua b/tex/context/base/luat-sto.lua
index 49ce887b4..7a11b7f5e 100644
--- a/tex/context/base/luat-sto.lua
+++ b/tex/context/base/luat-sto.lua
@@ -23,9 +23,6 @@ local storage      = storage
 local data         = { }
 storage.data       = data
 
-local evaluators   = { }
-storage.evaluators = evaluators
-
 storage.min        = 0 -- 500
 storage.max        = storage.min - 1
 storage.noftables  = storage.noftables or 0
diff --git a/tex/context/base/scrn-ini.lua b/tex/context/base/scrn-ini.lua
index 8fe1e0cae..4831408f9 100644
--- a/tex/context/base/scrn-ini.lua
+++ b/tex/context/base/scrn-ini.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['scrn-ini'] = {
     license   = "see context related readme files"
 }
 
+local next = next
+
 interactions         = { }
 interactions.general = interactions.general or { }
 local general        = interactions.general
diff --git a/tex/context/base/scrp-ini.lua b/tex/context/base/scrp-ini.lua
index b8f5d52d0..c375e2ec3 100644
--- a/tex/context/base/scrp-ini.lua
+++ b/tex/context/base/scrp-ini.lua
@@ -545,7 +545,7 @@ function autofontfeature.handler(head)
                     local slot = cache_yes[font]
                     local attr = slot[script]
                     if not attr then
-                        attr = mergecontext(dynamic,name,what)
+                        attr = mergecontext(dynamic,name,2)
                         slot[script] = attr
                         if trace_scripts then
                             report_scripts("script: %s, trigger %C, dynamic: %a, variant: %a",script,char,attr,"extended")
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 204a6f2ba..a68199b7d 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 1f12a5f7d..d27bb960e 100644
Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index c535acd71..2a3cf950d 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 : luatex-fonts-merged.lua
 -- parent file : luatex-fonts.lua
--- merge date  : 03/16/13 22:44:21
+-- merge date  : 03/17/13 13:31:17
 
 do -- begin closure to overcome local limits and interference
 
@@ -3484,9 +3484,6 @@ local constructors=fonts.constructors or {}
 fonts.constructors=constructors
 local handlers=fonts.handlers or {} 
 fonts.handlers=handlers
-local specifiers=fonts.specifiers
-local contextsetups=specifiers.contextsetups
-local contextnumbers=specifiers.contextnumbers
 local allocate=utilities.storage.allocate
 local setmetatableindex=table.setmetatableindex
 constructors.dontembed=allocate()
-- 
cgit v1.2.3