summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2013-01-27 21:24:00 +0100
committerHans Hagen <pragma@wxs.nl>2013-01-27 21:24:00 +0100
commitfa502d65e5e502ef6a26eeb246267ced520ed139 (patch)
tree01a1ec7a640311bf0af1ae1996675cae04000810 /tex
parent33fc570519a96f61b586ade8e4833326caaeaf7a (diff)
downloadcontext-fa502d65e5e502ef6a26eeb246267ced520ed139.tar.gz
beta 2013.01.27 21:24
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/cont-new.mkii2
-rw-r--r--tex/context/base/cont-new.mkiv12
-rw-r--r--tex/context/base/context-version.pdfbin4125 -> 4123 bytes
-rw-r--r--tex/context/base/context-version.pngbin40289 -> 40148 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/font-otn.lua24
-rw-r--r--tex/context/base/l-file.lua18
-rw-r--r--tex/context/base/l-io.lua2
-rw-r--r--tex/context/base/l-lpeg.lua9
-rw-r--r--tex/context/base/l-lua.lua32
-rw-r--r--tex/context/base/l-md5.lua7
-rw-r--r--tex/context/base/l-table.lua4
-rw-r--r--tex/context/base/l-unicode.lua47
-rw-r--r--tex/context/base/math-stc.mkvi2
-rw-r--r--tex/context/base/meta-ini.mkiv15
-rw-r--r--tex/context/base/mlib-run.lua6
-rw-r--r--tex/context/base/node-res.lua2
-rw-r--r--tex/context/base/node-ser.lua9
-rw-r--r--tex/context/base/pack-lyr.mkiv2
-rw-r--r--tex/context/base/pack-mrl.mkiv2
-rw-r--r--tex/context/base/page-imp.mkiv68
-rw-r--r--tex/context/base/status-files.pdfbin24760 -> 24756 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin208604 -> 208623 bytes
-rw-r--r--tex/context/base/strc-ref.lua4
-rw-r--r--tex/context/base/tabl-ntb.mkiv2
-rw-r--r--tex/context/base/trac-lmx.lua2
-rw-r--r--tex/context/base/util-deb.lua17
-rw-r--r--tex/context/base/util-mrg.lua24
-rw-r--r--tex/context/base/util-sql-imp-client.lua2
-rw-r--r--tex/context/base/util-sql-imp-library.lua2
-rw-r--r--tex/context/base/util-sql-imp-swiglib.lua2
-rw-r--r--tex/context/base/util-sql-users.lua7
-rw-r--r--tex/context/base/util-str.lua20
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua35
35 files changed, 313 insertions, 71 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index 54caea4b5..012c223a1 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.01.24 16:47}
+\newcontextversion{2013.01.27 21:24}
%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 e741bc444..b0e8ca3f6 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.01.24 16:47}
+\newcontextversion{2013.01.27 21:24}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
@@ -27,6 +27,16 @@
\unexpanded\def\tightvbox{\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\vbox}
\unexpanded\def\tightvtop{\dowithnextbox{\ht\nextbox\zeropoint\box\nextbox}\vtop}
+%D Maybe:
+
+% \startluacode
+% function context.loadfile(filename)
+% context(string.strip(io.loaddata(resolvers.findfile(filename))))
+% end
+% \stopluacode
+%
+% \edef\tufte{\cldcommand{loadfile("tufte.tex")}}
+
%D Needs some work:
\unexpanded\def\startgridcorrection
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index b458d0e4b..b694eabe1 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 4eaf49515..3dc8937ea 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 a2bad2e0f..4caa6812b 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.01.24 16:47}
+\edef\contextversion{2013.01.27 21:24}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index df4918a3c..e56e89ca1 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.01.24 16:47}
+\edef\contextversion{2013.01.27 21:24}
%D For those who want to use this:
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua
index 47d830f35..5cf1423ea 100644
--- a/tex/context/base/font-otn.lua
+++ b/tex/context/base/font-otn.lua
@@ -2162,12 +2162,12 @@ local function featuresprocessor(head,font,attr)
if lookupcache then
local lookupmatch = lookupcache[start.char]
if lookupmatch then
- local headnode = start == head
+ -- local headnode = start == head
start, success = handler(start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i)
if success then
- if headnode then
- head = start
- end
+ -- if headnode then
+ -- head = start
+ -- end
break
end
end
@@ -2211,14 +2211,14 @@ local function featuresprocessor(head,font,attr)
local lookupmatch = lookupcache[start.char]
if lookupmatch then
-- sequence kan weg
- local headnode = start == head
+ -- local headnode = start == head
local ok
start, ok = handler(start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,1)
if ok then
success = true
- if headnode then
- head = start
- end
+ -- if headnode then
+ -- head = start
+ -- end
end
end
if start then start = start.next end
@@ -2288,14 +2288,14 @@ local function featuresprocessor(head,font,attr)
local lookupmatch = lookupcache[start.char]
if lookupmatch then
-- we could move all code inline but that makes things even more unreadable
- local headnode = start == head
+ -- local headnode = start == head
local ok
start, ok = handler(start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i)
if ok then
success = true
- if headnode then
- head = start
- end
+ -- if headnode then
+ -- head = start
+ -- end
break
end
end
diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua
index 2a3d6991e..e91eeac4c 100644
--- a/tex/context/base/l-file.lua
+++ b/tex/context/base/l-file.lua
@@ -11,6 +11,24 @@ if not modules then modules = { } end modules ['l-file'] = {
file = file or { }
local file = file
+if not lfs then
+ lfs = {
+ getcurrentdir = function()
+ return "."
+ end,
+ attributes = function()
+ return nil
+ end,
+ isfile = function(name)
+ local f = io.open(name,'rb')
+ if f then
+ f:close()
+ return true
+ end
+ end,
+ }
+end
+
local insert, concat = table.insert, table.concat
local match = string.match
local lpegmatch = lpeg.match
diff --git a/tex/context/base/l-io.lua b/tex/context/base/l-io.lua
index e48b448c5..06e1fb5ef 100644
--- a/tex/context/base/l-io.lua
+++ b/tex/context/base/l-io.lua
@@ -86,6 +86,8 @@ function io.savedata(filename,data,joiner)
end
end
+-- we can also chunk this one if needed: io.lines(filename,chunksize,"*l")
+
function io.loadlines(filename,n) -- return nil if empty
local f = io.open(filename,'r')
if not f then
diff --git a/tex/context/base/l-lpeg.lua b/tex/context/base/l-lpeg.lua
index 8b5389aa1..d934df8e1 100644
--- a/tex/context/base/l-lpeg.lua
+++ b/tex/context/base/l-lpeg.lua
@@ -58,14 +58,19 @@ local byte, char, gmatch, format = string.byte, string.char, string.gmatch, stri
----- mod, div = math.mod, math.div
local floor = math.floor
+local P, R, S, V, Ct, C, Cs, Cc, Cp, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cp, lpeg.Cmt
+local lpegtype, lpegmatch, lpegprint = lpeg.type, lpeg.match, lpeg.print
+
+-- let's start with an inspector:
+
+setinspector(function(v) if lpegtype(v) then lpegprint(v) return true end end)
+
-- Beware, we predefine a bunch of patterns here and one reason for doing so
-- is that we get consistent behaviour in some of the visualizers.
lpeg.patterns = lpeg.patterns or { } -- so that we can share
local patterns = lpeg.patterns
-local P, R, S, V, Ct, C, Cs, Cc, Cp, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cp, lpeg.Cmt
-local lpegtype, lpegmatch = lpeg.type, lpeg.match
local anything = P(1)
local endofstring = P(-1)
diff --git a/tex/context/base/l-lua.lua b/tex/context/base/l-lua.lua
index 8ac351417..b62b7b070 100644
--- a/tex/context/base/l-lua.lua
+++ b/tex/context/base/l-lua.lua
@@ -13,6 +13,12 @@ local major, minor = string.match(_VERSION,"^[^%d]+(%d+)%.(%d+).*$")
_MAJORVERSION = tonumber(major) or 5
_MINORVERSION = tonumber(minor) or 1
+-- lpeg
+
+if not lpeg then
+ lpeg = require("lpeg")
+end
+
-- basics:
if loadstring then
@@ -105,3 +111,29 @@ if not package.loaders then -- brr, searchers is a special "loadlib function" us
package.loaders = package.searchers
end
+
+-- moved from util-deb to here:
+
+local print, select, tostring = print, select, tostring
+
+local inspectors = { }
+
+function setinspector(inspector) -- global function
+ inspectors[#inspectors+1] = inspector
+end
+
+function inspect(...) -- global function
+ for s=1,select("#",...) do
+ local value = select(s,...)
+ local done = false
+ for i=1,#inspectors do
+ done = inspectors[i](value)
+ if done then
+ break
+ end
+ end
+ if not done then
+ print(tostring(value))
+ end
+ end
+end
diff --git a/tex/context/base/l-md5.lua b/tex/context/base/l-md5.lua
index a60e4f575..c19c8248d 100644
--- a/tex/context/base/l-md5.lua
+++ b/tex/context/base/l-md5.lua
@@ -7,6 +7,13 @@ if not modules then modules = { } end modules ['l-md5'] = {
-- This also provides file checksums and checkers.
+if not md5 then
+ md5 = {
+ sum = function(str) print("error: md5 is not loaded (sum ignored)") return str end,
+ sumhexa = function(str) print("error: md5 is not loaded (sumhexa ignored)") return str end,
+ }
+end
+
local md5, file = md5, file
local gsub, format, byte = string.gsub, string.format, string.byte
diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua
index 8a2a9cad5..8b09518cb 100644
--- a/tex/context/base/l-table.lua
+++ b/tex/context/base/l-table.lua
@@ -967,10 +967,12 @@ function table.print(t,...)
if type(t) ~= "table" then
print(tostring(t))
else
- table.tohandle(print,t,...)
+ serialize(print,t,...)
end
end
+setinspector(function(v) if type(v) == "table" then serialize(print,v,"table") return true end end)
+
-- -- -- obsolete but we keep them for a while and might comment them later -- -- --
-- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack)
diff --git a/tex/context/base/l-unicode.lua b/tex/context/base/l-unicode.lua
index 7c452ef8f..de835a7d8 100644
--- a/tex/context/base/l-unicode.lua
+++ b/tex/context/base/l-unicode.lua
@@ -317,6 +317,11 @@ if not utf.len then
return n
end
+ -- -- these are quite a bit slower:
+
+ -- utfcharcounter = utfbom^-1 * (Cmt(P(1) * R("\128\191")^0, function() n = n + 1 return true end))^0 -- 50+ times slower
+ -- utfcharcounter = utfbom^-1 * (Cmt(P(1), function() n = n + 1 return true end) * R("\128\191")^0)^0 -- 50- times slower
+
end
utf.length = utf.len
@@ -845,3 +850,45 @@ else
end
-- maybe also register as string.utf*
+
+
+if not utf.characters then
+
+ -- New: this gmatch hack is taken from the Lua 5.2 book. It's about two times slower
+ -- than the built-in string.utfcharacters.
+
+ function utf.characters(str)
+ return gmatch(str,".[\128-\191]*")
+ end
+
+ string.utfcharacters = utf.characters
+
+end
+
+if not utf.values then
+
+ -- So, a logical next step is to check for the values variant. It over five times
+ -- slower than the built-in string.utfvalues. I optimized it a bit for n=0,1.
+
+ local wrap, yield, gmatch = coroutine.wrap, coroutine.yield, string.gmatch
+
+ local dummy = function()
+ -- we share this one
+ end
+
+ function utf.values(str)
+ local n = #str
+ if n == 0 then
+ return wrap(dummy)
+ elseif n == 1 then
+ return wrap(function() yield(utfbyte(str)) end)
+ else
+ return wrap(function() for s in gmatch(str,".[\128-\191]*") do
+ yield(utfbyte(s))
+ end end)
+ end
+ end
+
+ string.utfvalues = utf.values
+
+end
diff --git a/tex/context/base/math-stc.mkvi b/tex/context/base/math-stc.mkvi
index 622f2ac48..6e344cd62 100644
--- a/tex/context/base/math-stc.mkvi
+++ b/tex/context/base/math-stc.mkvi
@@ -408,7 +408,7 @@
\ifx\currentmathtext\empty
\setbox\scratchboxthree\emptyhbox
\else
- \setmathsmalltextbox\scratchboxthree\hbox{\math_stackers_middletext}%
+ \setmathtextbox\scratchboxthree\hbox{\math_stackers_middletext}%
\fi
\scratchwidth\wd\scratchboxthree
%
diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv
index ef7e86540..0f474fefe 100644
--- a/tex/context/base/meta-ini.mkiv
+++ b/tex/context/base/meta-ini.mkiv
@@ -849,14 +849,21 @@
\fi}
\def\meta_start_code_instance#1#2\stopMPcode
- {\meta_begin_graphic_group{#1}%
+ {\begingroup
+ \edef\currentMPinstance{#1}%
+ \let\currentMPgraphicname\empty
+ \edef\currentMPformat{\MPinstanceparameter\s!format}%
\meta_enable_include
\meta_process_graphic{#2}%
- \meta_end_graphic_group}
+ \endgroup}
\def\meta_start_code_standard#1#2\stopMPcode
- {\let\currentMPinstance\defaultMPinstance
- \meta_process_graphic{#2}}
+ {\begingroup
+ \let\currentMPinstance\defaultMPinstance
+ \let\currentMPgraphicname\empty
+ \edef\currentMPformat{\MPinstanceparameter\s!format}%
+ \meta_process_graphic{#2}%
+ \endgroup}
\let\stopMPcode\relax
diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua
index 16ab55c3b..18abf5aae 100644
--- a/tex/context/base/mlib-run.lua
+++ b/tex/context/base/mlib-run.lua
@@ -289,16 +289,20 @@ else
local methods = {
double = "double",
+ scaled = "scaled",
+ default = "scaled",
decimal = false, -- for the moment
}
function metapost.load(name,method)
starttiming(mplib)
+ method = method and methods[method] or "scaled"
local mpx = mplib.new {
ini_version = true,
find_file = finder,
- math_mode = method and methods[method] or nil,
+ math_mode = method,
}
+report_metapost("initializing number mode %q",method)
local result
if not mpx then
result = { status = 99, error = "out of memory"}
diff --git a/tex/context/base/node-res.lua b/tex/context/base/node-res.lua
index 45f8d54f4..5ac93da70 100644
--- a/tex/context/base/node-res.lua
+++ b/tex/context/base/node-res.lua
@@ -230,7 +230,7 @@ function pool.textdir(dir)
return t
end
-function pool.rule(width,height,depth,dir)
+function pool.rule(width,height,depth,dir) -- w/h/d == nil will let them adapt
local n = copy_node(rule)
if width then n.width = width end
if height then n.height = height end
diff --git a/tex/context/base/node-ser.lua b/tex/context/base/node-ser.lua
index 8e999f520..2c3e7fefb 100644
--- a/tex/context/base/node-ser.lua
+++ b/tex/context/base/node-ser.lua
@@ -10,13 +10,14 @@ if not modules then modules = { } end modules ['node-ser'] = {
-- of luatex; this is pretty old code that needs an overhaul
local type, format, rep = type, string.format, string.rep
-local concat, tohash, sortedkeys = table.concat, table.tohash, table.sortedkeys
+local concat, tohash, sortedkeys, printtable = table.concat, table.tohash, table.sortedkeys, table.print
local allocate = utilities.storage.allocate
local nodes, node = nodes, node
local traverse = node.traverse
+local is_node = node.is_node
local nodecodes = nodes.nodecodes
local noadcodes = nodes.noadcodes
@@ -71,7 +72,7 @@ nodes.ignorablefields = ignore
-- not ok yet:
-function nodes.astable(n,sparse) -- not yet ok
+local function astable(n,sparse) -- not yet ok
local f, t = nodefields(n), { }
for i=1,#f do
local v = f[i]
@@ -94,6 +95,10 @@ function nodes.astable(n,sparse) -- not yet ok
return t
end
+nodes.astable = astable
+
+setinspector(function(v) if is_node(v) then printtable(astable(v),tostring(v)) return true end end)
+
-- under construction:
local function totable(n,flat,verbose,noattributes)
diff --git a/tex/context/base/pack-lyr.mkiv b/tex/context/base/pack-lyr.mkiv
index 5b23a255d..a891c998d 100644
--- a/tex/context/base/pack-lyr.mkiv
+++ b/tex/context/base/pack-lyr.mkiv
@@ -223,7 +223,7 @@
\def\pack_layers_set[#1][#2][#3]% #4 == box do \fi is ok
{\bgroup
\edef\currentlayer{#1}%
- \edef\p_pack_layers_state{\layerparameter{#1}\c!state}%
+ \edef\p_pack_layers_state{\layerparameter\c!state}%
\ifx\p_pack_layers_state\v!stop
\dowithnextboxcs\egroup\hbox
\else\ifthirdargument
diff --git a/tex/context/base/pack-mrl.mkiv b/tex/context/base/pack-mrl.mkiv
index ec214d4f3..501bf70d6 100644
--- a/tex/context/base/pack-mrl.mkiv
+++ b/tex/context/base/pack-mrl.mkiv
@@ -244,7 +244,7 @@
\newconstant\c_pack_thinrules_type
-\def\thinrule
+\unexpanded\def\thinrule
{\strut
\bgroup
\edef\p_height {\directthinrulesparameter\c!height}%
diff --git a/tex/context/base/page-imp.mkiv b/tex/context/base/page-imp.mkiv
index 5eb587b7b..db7986c28 100644
--- a/tex/context/base/page-imp.mkiv
+++ b/tex/context/base/page-imp.mkiv
@@ -1091,7 +1091,73 @@
\or \handlearrangedpageXandY{#1}000\arrangedpageA % 12
\poparrangedpages
\fi}
-
+
+% % From Wolfgang for Mari (mail on list) ... yes or no in core .. time for
+% % delayed loading ...
+% %
+% % http://stamphenge.wordpress.com/minibooks/meander-accordion-folded-book/
+%
+% \installpagearrangement MEANDER16
+% {\dosetuparrangement{4}{4}{16}{5}{5}%
+% \pusharrangedpageMEANDERSIXTEEN\poparrangedpagesXY\relax}
+%
+% \def\pusharrangedpageMEANDERSIXTEEN#1%
+% {\advancearrangedpageN
+% \reportarrangedpage\arrangedpageN
+% \ifcase\arrangedpageN
+% \or \handlearrangedpageXandY{#1}000\arrangedpageA
+% \or \handlearrangedpageXandY{#1}010\arrangedpageA
+% \or \handlearrangedpageXandY{#1}020\arrangedpageA
+% \or \handlearrangedpageXandY{#1}030\arrangedpageA
+% \or \handlearrangedpageXandY{#1}131\arrangedpageA
+% \or \handlearrangedpageXandY{#1}121\arrangedpageA
+% \or \handlearrangedpageXandY{#1}111\arrangedpageA
+% \or \handlearrangedpageXandY{#1}101\arrangedpageA
+% \or \handlearrangedpageXandY{#1}002\arrangedpageA
+% \or \handlearrangedpageXandY{#1}012\arrangedpageA
+% \or \handlearrangedpageXandY{#1}022\arrangedpageA
+% \or \handlearrangedpageXandY{#1}032\arrangedpageA
+% \or \handlearrangedpageXandY{#1}133\arrangedpageA
+% \or \handlearrangedpageXandY{#1}123\arrangedpageA
+% \or \handlearrangedpageXandY{#1}113\arrangedpageA
+% \or \handlearrangedpageXandY{#1}103\arrangedpageA
+% \poparrangedpages
+% \fi}
+%
+% % \definepapersize[small][width=6cm,height=6cm]
+% % \definepapersize[big][width=30cm,height=30cm]
+% % \setuppapersize[small][big]
+% % \setuppagenumbering[location=]
+% % \setuparranging[MEANDER16]
+% % \setuplayout
+% % [location=middle,
+% % marking=on]
+% % \starttext
+% % \dorecurse{32}{\centerbox{\ssd\recurselevel}}
+% % \stoptext
+%
+% % By Willi:
+%
+% \installpagearrangement MEANDER9
+% {\dosetuparrangement{3}{3}{9}{4}{4}%
+% \pusharrangedpageMEANDERNINE\poparrangedpagesXY\relax}
+%
+% \def\pusharrangedpageMEANDERNINE#1%
+% {\advancearrangedpageN
+% \reportarrangedpage\arrangedpageN
+% \ifcase\arrangedpageN
+% \or \handlearrangedpageXandY{#1}000\arrangedpageA
+% \or \handlearrangedpageXandY{#1}010\arrangedpageA
+% \or \handlearrangedpageXandY{#1}020\arrangedpageA
+% \or \handlearrangedpageXandY{#1}121\arrangedpageA
+% \or \handlearrangedpageXandY{#1}111\arrangedpageA
+% \or \handlearrangedpageXandY{#1}101\arrangedpageA
+% \or \handlearrangedpageXandY{#1}002\arrangedpageA
+% \or \handlearrangedpageXandY{#1}012\arrangedpageA
+% \or \handlearrangedpageXandY{#1}022\arrangedpageA
+% \poparrangedpages
+% \fi}
+
% % handy for stickers etc, this way we can treat them as page
%
% \setuppapersize [XY][A4]
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index e5a0ac4cc..757113224 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 eae5bc446..0520a2f96 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua
index 7f37f20ff..61f9dc69e 100644
--- a/tex/context/base/strc-ref.lua
+++ b/tex/context/base/strc-ref.lua
@@ -1733,7 +1733,7 @@ function references.filter(name,...) -- number page title ...
if data then
if name == "realpage" then
local cs = references.analyze() -- normally already analyzed but also sets state
- context(cs.realpage or 0) -- todo, return and in command namespace
+ context(tonumber(cs.realpage) or 0) -- todo, return and in command namespace
else -- assumes data is table
local kind = type(data) == "table" and data.metadata and data.metadata.kind
if kind then
@@ -1751,6 +1751,8 @@ function references.filter(name,...) -- number page title ...
report_references("name '%s', unknown kind",name)
end
end
+ elseif name == "realpage" then
+ context(0)
elseif trace_referencing then
report_references("name '%s', no reference",name)
end
diff --git a/tex/context/base/tabl-ntb.mkiv b/tex/context/base/tabl-ntb.mkiv
index 9c7864184..fa42055b1 100644
--- a/tex/context/base/tabl-ntb.mkiv
+++ b/tex/context/base/tabl-ntb.mkiv
@@ -1702,7 +1702,7 @@
\c!headcolor=,
\c!aligncharacter=\v!no,
\c!alignmentcharacter={,},
- \c!maxwidth=8em]%
+ \c!maxwidth=8\emwidth]%
\else
\setupTABLE
[\c!width=\v!fit,
diff --git a/tex/context/base/trac-lmx.lua b/tex/context/base/trac-lmx.lua
index 97938fb77..474869bae 100644
--- a/tex/context/base/trac-lmx.lua
+++ b/tex/context/base/trac-lmx.lua
@@ -6,6 +6,8 @@ if not modules then modules = { } end modules ['trac-lmx'] = {
license = "see context related readme files"
}
+-- this one will be adpated to the latest helpers
+
local type, tostring, rawget, loadstring, pcall = type, tostring, rawget, loadstring, pcall
local format, sub, gsub = string.format, string.sub, string.gsub
local concat = table.concat
diff --git a/tex/context/base/util-deb.lua b/tex/context/base/util-deb.lua
index 33d43b25f..d4b0831f2 100644
--- a/tex/context/base/util-deb.lua
+++ b/tex/context/base/util-deb.lua
@@ -108,23 +108,6 @@ end
--~ print("")
--~ debugger.showstats(print,3)
-local is_node = node and node.is_node
-local is_lpeg = lpeg and lpeg.type
-
-function inspect(i) -- global function
- local ti = type(i)
- if ti == "table" then
- table.print(i,"table")
- elseif is_node and is_node(i) then
- table.print(nodes.astable(i),tostring(i))
- elseif is_lpeg and is_lpeg(i) then
- lpeg.print(i)
- else
- print(tostring(i))
- end
- return i -- so that we can inline the inspect
-end
-
-- from the lua book:
function traceback()
diff --git a/tex/context/base/util-mrg.lua b/tex/context/base/util-mrg.lua
index fad7ef0a1..cdac10ac1 100644
--- a/tex/context/base/util-mrg.lua
+++ b/tex/context/base/util-mrg.lua
@@ -12,6 +12,9 @@ local gsub, format = string.gsub, string.format
local concat = table.concat
local type, next = type, next
+local P, R, S, V, Ct, C, Cs, Cc, Cp, Cmt, Cb, Cg = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cp, lpeg.Cmt, lpeg.Cb, lpeg.Cg
+local lpegmatch, patterns = lpeg.match, lpeg.patterns
+
utilities = utilities or { }
local merger = utilities.merger or { }
utilities.merger = merger
@@ -71,17 +74,14 @@ end
-- -- saves some 20K .. ldx comments
-- data = gsub(data,"%-%-%[%[ldx%-%-.-%-%-ldx%]%]%-%-","")
-local P, R, S, V, Ct, C, Cs, Cc, Cp, Cmt, Cb, Cg = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cp, lpeg.Cmt, lpeg.Cb, lpeg.Cg
-local lpegmatch, patterns = lpeg.match, lpeg.patterns
-
+local space = patterns.space
+local eol = patterns.newline
local equals = P("=")^0
local open = P("[") * Cg(equals,"init") * P("[") * P("\n")^-1
local close = P("]") * C(equals) * P("]")
local closeeq = Cmt(close * Cb("init"), function(s,i,a,b) return a == b end)
local longstring = open * (1 - closeeq)^0 * close
-local space = patterns.space
-local eol = patterns.newline
local quoted = patterns.quoted
local emptyline = space^0 * eol
local operator1 = P("<=") + P(">=") + P("~=") + P("..") + S("/^<>=*+%%")
@@ -117,22 +117,22 @@ local compact = Cs ( (
1
)^1 )
-local strip = Cs((emptyline^2/"\n" + 1)^0)
+local strip = Cs((emptyline^2/"\n" + 1)^0)
+local stripreturn = Cs((1-P("return") * space^1 * P(1-space-eol)^1 * (space+eol)^0 * P(-1))^1)
local function self_compact(data)
+ local delta = 0
if merger.strip_comment then
local before = #data
- data = lpeg.match(compact,data)
- data = lpeg.match(strip,data)
+ data = lpegmatch(compact,data)
+ data = lpegmatch(strip,data)
-- data = string.strip(data)
local after = #data
- local delta = before - after
+ delta = before - after
utilities.report("merge: %s bytes compacted to %s (%s bytes stripped)",before,after,delta)
data = format("-- original size: %s, stripped down to: %s\n\n%s",before,after,data)
- return data, delta
- else
- return data, 0
end
+ return lpegmatch(stripreturn,data) or data, delta
end
local function self_save(name, data)
diff --git a/tex/context/base/util-sql-imp-client.lua b/tex/context/base/util-sql-imp-client.lua
index 8e174fc99..b53bc2dda 100644
--- a/tex/context/base/util-sql-imp-client.lua
+++ b/tex/context/base/util-sql-imp-client.lua
@@ -15,7 +15,7 @@ local trace_sql = false trackers.register("sql.trace", function(v) tr
local trace_queries = false trackers.register("sql.queries",function(v) trace_queries = v end)
local report_state = logs.reporter("sql","client")
-local sql = require("util-sql")
+local sql = utilities.sql
local helpers = sql.helpers
local methods = sql.methods
local validspecification = helpers.validspecification
diff --git a/tex/context/base/util-sql-imp-library.lua b/tex/context/base/util-sql-imp-library.lua
index 108de480a..3167b95f5 100644
--- a/tex/context/base/util-sql-imp-library.lua
+++ b/tex/context/base/util-sql-imp-library.lua
@@ -70,7 +70,7 @@ local trace_sql = false trackers.register("sql.trace", function(v) tr
local trace_queries = false trackers.register("sql.queries",function(v) trace_queries = v end)
local report_state = logs.reporter("sql","library")
-local sql = require("util-sql")
+local sql = utilities.sql
local mysql = require("luasql.mysql")
local cache = { }
local helpers = sql.helpers
diff --git a/tex/context/base/util-sql-imp-swiglib.lua b/tex/context/base/util-sql-imp-swiglib.lua
index 25723ee84..d923dec3d 100644
--- a/tex/context/base/util-sql-imp-swiglib.lua
+++ b/tex/context/base/util-sql-imp-swiglib.lua
@@ -20,7 +20,7 @@ local trace_sql = false trackers.register("sql.trace", function(v
local trace_queries = false trackers.register("sql.queries",function(v) trace_queries = v end)
local report_state = logs.reporter("sql","swiglib")
-local sql = require("util-sql")
+local sql = utilities.sql
local mysql = require("swigluamysql")
local cache = { }
local helpers = sql.helpers
diff --git a/tex/context/base/util-sql-users.lua b/tex/context/base/util-sql-users.lua
index 5b6d0906a..23bf9edb6 100644
--- a/tex/context/base/util-sql-users.lua
+++ b/tex/context/base/util-sql-users.lua
@@ -10,13 +10,16 @@ if not modules then modules = { } end modules ['util-sql-users'] = {
-- because it's easier to dirtribute this way. Eventually it will be documented
-- and the related scripts will show up as well.
-local sql = require("util-sql")
-local md5 = require("md5")
+-- local sql = sql or (utilities and utilities.sql) or require("util-sql")
+-- local md5 = md5 or require("md5")
+
+local sql = utilities.sql
local format, upper, find, gsub, topattern = string.format, string.upper, string.find, string.gsub, string.topattern
local sumhexa = md5.sumhexa
local booleanstring = string.booleanstring
+local sql = utilities.sql
local users = { }
sql.users = users
diff --git a/tex/context/base/util-str.lua b/tex/context/base/util-str.lua
index bade3493a..a4889d252 100644
--- a/tex/context/base/util-str.lua
+++ b/tex/context/base/util-str.lua
@@ -185,6 +185,23 @@ end
local format_d = format_i
+function number.signed(i)
+ if i > 0 then
+ return "+", i
+ else
+ return "-", -i
+ end
+end
+
+local format_I = function(f)
+ n = n + 1
+ if f and f ~= "" then
+ return format("format('%%s%%%si',signed((select(%s,...))))",f,n)
+ else
+ return format("format('%%s%%i',signed((select(%s,...))))",n)
+ end
+end
+
local format_f = function(f)
n = n + 1
return format("format('%%%sf',(select(%s,...)))",f,n)
@@ -317,6 +334,7 @@ local builder = Ct { "start",
+ V("p") + V("b")
+ V("t")
+ V("l")
+ + V("I")
)
+ V("a")
)^0,
@@ -345,6 +363,7 @@ local builder = Ct { "start",
["b"] = (prefix_any * P("b")) / format_b, -- %b => 12.342bp / maybe: B (and more units)
["t"] = (prefix_tab * P("t")) / format_t, -- %t => concat
["l"] = (prefix_tab * P("l")) / format_l, -- %l => boolean
+ ["I"] = (prefix_any * P("I")) / format_I, -- %I => signed integer
--
["a"] = Cs(((1-P("%"))^1 + P("%%")/"%%")^1) / format_a, -- %a => text (including %%)
}
@@ -354,6 +373,7 @@ local builder = Ct { "start",
local template = [[
local format = string.format
local concat = table.concat
+local signed = number.signed
local points = number.points
local basepoints = number.basepoints
local utfchar = utf.char
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index d018e349b..b73c7da6a 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 : 01/24/13 16:47:41
+-- merge date : 01/27/13 21:24:19
do -- begin closure to overcome local limits and interference
@@ -64,14 +64,19 @@ local byte, char, gmatch, format = string.byte, string.char, string.gmatch, stri
----- mod, div = math.mod, math.div
local floor = math.floor
+local P, R, S, V, Ct, C, Cs, Cc, Cp, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cp, lpeg.Cmt
+local lpegtype, lpegmatch, lpegprint = lpeg.type, lpeg.match, lpeg.print
+
+-- let's start with an inspector:
+
+setinspector(function(v) if lpegtype(v) then lpegprint(v) return true end end)
+
-- Beware, we predefine a bunch of patterns here and one reason for doing so
-- is that we get consistent behaviour in some of the visualizers.
lpeg.patterns = lpeg.patterns or { } -- so that we can share
local patterns = lpeg.patterns
-local P, R, S, V, Ct, C, Cs, Cc, Cp, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.Ct, lpeg.C, lpeg.Cs, lpeg.Cc, lpeg.Cp, lpeg.Cmt
-local lpegtype, lpegmatch = lpeg.type, lpeg.match
local anything = P(1)
local endofstring = P(-1)
@@ -2027,10 +2032,12 @@ function table.print(t,...)
if type(t) ~= "table" then
print(tostring(t))
else
- table.tohandle(print,t,...)
+ serialize(print,t,...)
end
end
+setinspector(function(v) if type(v) == "table" then serialize(print,v,"table") return true end end)
+
-- -- -- obsolete but we keep them for a while and might comment them later -- -- --
-- roughly: copy-loop : unpack : sub == 0.9 : 0.4 : 0.45 (so in critical apps, use unpack)
@@ -2213,6 +2220,24 @@ if not modules then modules = { } end modules ['l-file'] = {
file = file or { }
local file = file
+if not lfs then
+ lfs = {
+ getcurrentdir = function()
+ return "."
+ end,
+ attributes = function()
+ return nil
+ end,
+ isfile = function(name)
+ local f = io.open(name,'rb')
+ if f then
+ f:close()
+ return true
+ end
+ end,
+ }
+end
+
local insert, concat = table.insert, table.concat
local match = string.match
local lpegmatch = lpeg.match
@@ -2803,6 +2828,8 @@ function io.savedata(filename,data,joiner)
end
end
+-- we can also chunk this one if needed: io.lines(filename,chunksize,"*l")
+
function io.loadlines(filename,n) -- return nil if empty
local f = io.open(filename,'r')
if not f then