summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/context/lua/mtxrun.lua39
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua39
-rw-r--r--scripts/context/stubs/unix/mtxrun39
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv2
-rw-r--r--tex/context/base/context-version.pdfbin4144 -> 4142 bytes
-rw-r--r--tex/context/base/context-version.pngbin40394 -> 40408 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-uti.lua56
-rw-r--r--tex/context/base/core-uti.mkiv8
-rw-r--r--tex/context/base/status-files.pdfbin24545 -> 24557 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin196247 -> 196243 bytes
-rw-r--r--tex/context/base/status-mkiv.lua6
-rw-r--r--tex/context/base/strc-ref.mkvi7
-rw-r--r--tex/context/base/strc-sec.mkiv6
-rw-r--r--tex/context/base/util-tab.lua39
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
18 files changed, 181 insertions, 68 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 96b153adf..114d2ef0c 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -4771,18 +4771,43 @@ local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatabl
local type, next, rawset, tonumber, loadstring = type, next, rawset, tonumber, loadstring
local lpegmatch, P, Cs = lpeg.match, lpeg.P, lpeg.Cs
-function tables.definetable(target) -- defines undefined tables
- local composed, t, n = nil, { }, 0
- for name in gmatch(target,"([^%.]+)") do
- n = n + 1
+-- function tables.definetable(target) -- defines undefined tables
+-- local composed, t, n = nil, { }, 0
+-- for name in gmatch(target,"([^%.]+)") do
+-- n = n + 1
+-- if composed then
+-- composed = composed .. "." .. name
+-- else
+-- composed = name
+-- end
+-- t[n] = format("%s = %s or { }",composed,composed)
+-- end
+-- return concat(t,"\n")
+-- end
+
+local splitter = lpeg.tsplitat(".")
+
+function tables.definetable(target,nofirst,nolast) -- defines undefined tables
+ local composed, shortcut, t = nil, nil, { }
+ local snippets = lpegmatch(splitter,target)
+ for i=1,#snippets - (nolast and 1 or 0) do
+ local name = snippets[i]
if composed then
- composed = composed .. "." .. name
+ composed = shortcut .. "." .. name
+ shortcut = shortcut .. "_" .. name
+ t[#t+1] = format("local %s = %s if not %s then %s = { } %s = %s end",shortcut,composed,shortcut,shortcut,composed,shortcut)
else
composed = name
+ shortcut = name
+ if not nofirst then
+ t[#t+1] = format("%s = %s or { }",composed,composed)
+ end
end
- t[n] = format("%s = %s or { }",composed,composed)
end
- return concat(t,"\n")
+ if nolast then
+ composed = shortcut .. "." .. snippets[#snippets]
+ end
+ return concat(t,"\n"), composed
end
function tables.accesstable(target,root)
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 96b153adf..114d2ef0c 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -4771,18 +4771,43 @@ local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatabl
local type, next, rawset, tonumber, loadstring = type, next, rawset, tonumber, loadstring
local lpegmatch, P, Cs = lpeg.match, lpeg.P, lpeg.Cs
-function tables.definetable(target) -- defines undefined tables
- local composed, t, n = nil, { }, 0
- for name in gmatch(target,"([^%.]+)") do
- n = n + 1
+-- function tables.definetable(target) -- defines undefined tables
+-- local composed, t, n = nil, { }, 0
+-- for name in gmatch(target,"([^%.]+)") do
+-- n = n + 1
+-- if composed then
+-- composed = composed .. "." .. name
+-- else
+-- composed = name
+-- end
+-- t[n] = format("%s = %s or { }",composed,composed)
+-- end
+-- return concat(t,"\n")
+-- end
+
+local splitter = lpeg.tsplitat(".")
+
+function tables.definetable(target,nofirst,nolast) -- defines undefined tables
+ local composed, shortcut, t = nil, nil, { }
+ local snippets = lpegmatch(splitter,target)
+ for i=1,#snippets - (nolast and 1 or 0) do
+ local name = snippets[i]
if composed then
- composed = composed .. "." .. name
+ composed = shortcut .. "." .. name
+ shortcut = shortcut .. "_" .. name
+ t[#t+1] = format("local %s = %s if not %s then %s = { } %s = %s end",shortcut,composed,shortcut,shortcut,composed,shortcut)
else
composed = name
+ shortcut = name
+ if not nofirst then
+ t[#t+1] = format("%s = %s or { }",composed,composed)
+ end
end
- t[n] = format("%s = %s or { }",composed,composed)
end
- return concat(t,"\n")
+ if nolast then
+ composed = shortcut .. "." .. snippets[#snippets]
+ end
+ return concat(t,"\n"), composed
end
function tables.accesstable(target,root)
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 96b153adf..114d2ef0c 100644
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -4771,18 +4771,43 @@ local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatabl
local type, next, rawset, tonumber, loadstring = type, next, rawset, tonumber, loadstring
local lpegmatch, P, Cs = lpeg.match, lpeg.P, lpeg.Cs
-function tables.definetable(target) -- defines undefined tables
- local composed, t, n = nil, { }, 0
- for name in gmatch(target,"([^%.]+)") do
- n = n + 1
+-- function tables.definetable(target) -- defines undefined tables
+-- local composed, t, n = nil, { }, 0
+-- for name in gmatch(target,"([^%.]+)") do
+-- n = n + 1
+-- if composed then
+-- composed = composed .. "." .. name
+-- else
+-- composed = name
+-- end
+-- t[n] = format("%s = %s or { }",composed,composed)
+-- end
+-- return concat(t,"\n")
+-- end
+
+local splitter = lpeg.tsplitat(".")
+
+function tables.definetable(target,nofirst,nolast) -- defines undefined tables
+ local composed, shortcut, t = nil, nil, { }
+ local snippets = lpegmatch(splitter,target)
+ for i=1,#snippets - (nolast and 1 or 0) do
+ local name = snippets[i]
if composed then
- composed = composed .. "." .. name
+ composed = shortcut .. "." .. name
+ shortcut = shortcut .. "_" .. name
+ t[#t+1] = format("local %s = %s if not %s then %s = { } %s = %s end",shortcut,composed,shortcut,shortcut,composed,shortcut)
else
composed = name
+ shortcut = name
+ if not nofirst then
+ t[#t+1] = format("%s = %s or { }",composed,composed)
+ end
end
- t[n] = format("%s = %s or { }",composed,composed)
end
- return concat(t,"\n")
+ if nolast then
+ composed = shortcut .. "." .. snippets[#snippets]
+ end
+ return concat(t,"\n"), composed
end
function tables.accesstable(target,root)
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 03cebce07..5df023d60 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{2012.11.07 23:16}
+\newcontextversion{2012.11.08 12:14}
%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 e1f85e6d8..4defa804f 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{2012.11.07 23:16}
+\newcontextversion{2012.11.08 12:14}
%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 52c1333f5..0a36a7401 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png
index 32b440ce1..60c95e28a 100644
--- a/tex/context/base/context-version.png
+++ b/tex/context/base/context-version.png
Binary files differ
diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii
index 784ae89f4..497656624 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{2012.11.07 23:16}
+\edef\contextversion{2012.11.08 12:14}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index f11caecba..77d30f666 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{2012.11.07 23:16}
+\edef\contextversion{2012.11.08 12:14}
%D For those who want to use this:
diff --git a/tex/context/base/core-uti.lua b/tex/context/base/core-uti.lua
index 141f20cd3..31f13a0fc 100644
--- a/tex/context/base/core-uti.lua
+++ b/tex/context/base/core-uti.lua
@@ -22,20 +22,20 @@ local next, type, tostring = next, type, tostring
local concat = table.concat
local texcount = tex.count
-local definetable = utilities.tables.definetable
-local accesstable = utilities.tables.accesstable
-local migratetable = utilities.tables.migratetable
-local serialize = table.serialize
-local packers = utilities.packers
-local allocate = utilities.storage.allocate
-local mark = utilities.storage.mark
+local definetable = utilities.tables.definetable
+local accesstable = utilities.tables.accesstable
+local migratetable = utilities.tables.migratetable
+local serialize = table.serialize
+local packers = utilities.packers
+local allocate = utilities.storage.allocate
+local mark = utilities.storage.mark
-local report_passes = logs.reporter("job","passes")
+local report_passes = logs.reporter("job","passes")
-job = job or { }
-local job = job
+job = job or { }
+local job = job
-job.version = 1.19
+job.version = "1.20"
-- some day we will implement loading of other jobs and then we need
-- job.jobs
@@ -48,11 +48,11 @@ directly access the variable using a <l n='lua'/> call.</p>
local savelist, comment = { }, { }
-function job.comment(str)
- comment[#comment+1] = str
+function job.comment(key,value)
+ comment[key] = value
end
-job.comment(format("version: %1.2f",job.version))
+job.comment("version",job.version)
local enabled = true
@@ -144,10 +144,8 @@ function job.save(filename) -- we could return a table but it can get pretty lar
statistics.starttiming(_save_)
local f = io.open(filename,'w')
if f then
- for c=1,#comment do
- f:write("-- ",comment[c],"\n")
- end
- f:write("\nlocal utilitydata = { }\n\n")
+ f:write("local utilitydata = { }\n\n")
+ f:write(serialize(comment,"utilitydata.comment",true,true),"\n\n")
for l=1,#savelist do
local list = savelist[l]
local target = format("utilitydata.%s",list[1])
@@ -159,27 +157,29 @@ function job.save(filename) -- we could return a table but it can get pretty lar
if job.pack then
packers.pack(data,jobpacker,true)
end
- f:write(definetable(target),"\n",serialize(data,target,true,true),"\n")
+ local definer, name = definetable(target,true,true) -- no first and no last
+ f:write(definer,"\n\n",serialize(data,name,true,true),"\n\n")
end
if job.pack then
packers.strip(jobpacker)
- f:write(serialize(jobpacker,"utilitydata.job.packed",true,true),"\n")
+ f:write(serialize(jobpacker,"utilitydata.job.packed",true,true),"\n\n")
end
- f:write("\nreturn utilitydata\n\n")
+ f:write("return utilitydata")
f:close()
end
statistics.stoptiming(_save_)
end
local function load(filename)
- local data = io.loaddata(filename)
- if data and data ~= "" then
- local version = tonumber(match(data,"^-- version: ([%d%.]+)"))
- if version ~= job.version then
- report_passes("version mismatch: %s <> %s", version or "?", job.version)
+ local okay, data = pcall(dofile,filename)
+ if okay and type(data) == "table" then
+ local jobversion = job.version
+ local datacomment = data.comment
+ local dataversion = datacomment and datacomment.version or "?"
+ if dataversion ~= jobversion then
+ report_passes("version mismatch: %s <> %s",dataversion,jobversion)
else
- local data = loadstring(data)
- return data and data()
+ return data
end
end
end
diff --git a/tex/context/base/core-uti.mkiv b/tex/context/base/core-uti.mkiv
index 9a783f78a..da4a98fb7 100644
--- a/tex/context/base/core-uti.mkiv
+++ b/tex/context/base/core-uti.mkiv
@@ -22,10 +22,10 @@
\appendtoks
\ctxlua {
- job.comment("file: \jobname")
- job.comment("format: \contextformat")
- job.comment("stamp: \contextversion")
- job.comment("escape: \!!bs\space...\space\!!es")
+ job.comment("file","\jobname")
+ job.comment("format","\contextformat")
+ job.comment("stamp","\contextversion")
+ job.comment("escape","\!!bs\space...\space\!!es")
}%
\to \everystarttext
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 83def6697..e0e66e4c3 100644
--- a/tex/context/base/status-files.pdf
+++ b/tex/context/base/status-files.pdf
Binary files differ
diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf
index c65b621fc..4e2f295ee 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua
index 3b19284f6..f9e28c879 100644
--- a/tex/context/base/status-mkiv.lua
+++ b/tex/context/base/status-mkiv.lua
@@ -707,7 +707,7 @@ return {
},
{
category = "mkiv",
- comment = "this module migh tgo away when code has been moved",
+ comment = "this module might go away when code has been moved",
filename = "strc-doc",
loading = "always",
status = "okay",
@@ -732,7 +732,7 @@ return {
status = "okay",
},
{
- category = "mkvI",
+ category = "mkvi",
filename = "strc-lst",
loading = "always",
status = "okay",
@@ -2791,7 +2791,7 @@ return {
comment = "some code will move to better places",
filename = "core-uti",
loading = "core-uti",
- status = "pending",
+ status = "okay",
},
{
category = "lua",
diff --git a/tex/context/base/strc-ref.mkvi b/tex/context/base/strc-ref.mkvi
index 7efc967b7..2ace41c90 100644
--- a/tex/context/base/strc-ref.mkvi
+++ b/tex/context/base/strc-ref.mkvi
@@ -682,6 +682,13 @@
\hbox attr \destinationattribute\lastdestinationattribute{}%
\endgroup}
+\installcorenamespace{savedinternalreference}
+
+\letvalue{\??savedinternalreference\s!default}\!!zerocount
+
+\unexpanded\def\storeinternalreference#1#2%
+ {\setxvalue{\??savedinternalreference\currentstructurename}{#2}}
+
\newconditional\preferpagereferences
\def\gotosomeinternal#kind#name#target#text%
diff --git a/tex/context/base/strc-sec.mkiv b/tex/context/base/strc-sec.mkiv
index 826de59bf..9cd1cf081 100644
--- a/tex/context/base/strc-sec.mkiv
+++ b/tex/context/base/strc-sec.mkiv
@@ -83,6 +83,11 @@
\c!reference=\headparameter\c!reference,
\c!referenceprefix=\headparameter\c!referenceprefix]
+% see lists/neat-001.tex for usage of:
+
+\def\namedstructureheadlocation#1% expandable, maybe [#1]
+ {\csname\??savedinternalreference\ifcsname\??savedinternalreference#1\endcsname#1\else\s!default\fi\endcsname}
+
\unexpanded\def\strc_sectioning_register#1#2#3% #1=interfaced-settings, #2=optional user data (not yet supported)
{\begingroup
\setupstructure[\c!name={#1},#2]%
@@ -135,6 +140,7 @@
\globallet\currentstructurecoding\s!tex
\fi
\setnextinternalreference
+ \storeinternalreference\currentstructurename\nextinternalreference %
\strc_sectioning_set_reference_prefix
\xdef\currentstructurenumber{\ctxlua{ % todo: combine with next call, adapt marks accordingly
structures.sections.somelevel {
diff --git a/tex/context/base/util-tab.lua b/tex/context/base/util-tab.lua
index 7a2da298e..b9f41ce9b 100644
--- a/tex/context/base/util-tab.lua
+++ b/tex/context/base/util-tab.lua
@@ -16,18 +16,43 @@ local setmetatable, getmetatable, tonumber, tostring = setmetatable, getmetatabl
local type, next, rawset, tonumber, loadstring = type, next, rawset, tonumber, loadstring
local lpegmatch, P, Cs = lpeg.match, lpeg.P, lpeg.Cs
-function tables.definetable(target) -- defines undefined tables
- local composed, t, n = nil, { }, 0
- for name in gmatch(target,"([^%.]+)") do
- n = n + 1
+-- function tables.definetable(target) -- defines undefined tables
+-- local composed, t, n = nil, { }, 0
+-- for name in gmatch(target,"([^%.]+)") do
+-- n = n + 1
+-- if composed then
+-- composed = composed .. "." .. name
+-- else
+-- composed = name
+-- end
+-- t[n] = format("%s = %s or { }",composed,composed)
+-- end
+-- return concat(t,"\n")
+-- end
+
+local splitter = lpeg.tsplitat(".")
+
+function tables.definetable(target,nofirst,nolast) -- defines undefined tables
+ local composed, shortcut, t = nil, nil, { }
+ local snippets = lpegmatch(splitter,target)
+ for i=1,#snippets - (nolast and 1 or 0) do
+ local name = snippets[i]
if composed then
- composed = composed .. "." .. name
+ composed = shortcut .. "." .. name
+ shortcut = shortcut .. "_" .. name
+ t[#t+1] = format("local %s = %s if not %s then %s = { } %s = %s end",shortcut,composed,shortcut,shortcut,composed,shortcut)
else
composed = name
+ shortcut = name
+ if not nofirst then
+ t[#t+1] = format("%s = %s or { }",composed,composed)
+ end
end
- t[n] = format("%s = %s or { }",composed,composed)
end
- return concat(t,"\n")
+ if nolast then
+ composed = shortcut .. "." .. snippets[#snippets]
+ end
+ return concat(t,"\n"), composed
end
function tables.accesstable(target,root)
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 0b07ef402..4cbdcd152 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 : 11/07/12 23:16:09
+-- merge date : 11/08/12 12:14:23
do -- begin closure to overcome local limits and interference