summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-10-30 13:00:16 +0200
committerMarius <mariausol@gmail.com>2012-10-30 13:00:16 +0200
commit5f32a409560fd59c6ecc68aa35ee3c1fc8481352 (patch)
tree2078ec664e753d31894c631bc761b75e0426c8a0 /tex
parent3fcaa5434b428fcc717fbd06822b54ec18194c62 (diff)
downloadcontext-5f32a409560fd59c6ecc68aa35ee3c1fc8481352.tar.gz
beta 2012.10.30 11:35
Diffstat (limited to 'tex')
-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.pdfbin4150 -> 4145 bytes
-rw-r--r--tex/context/base/context-version.pngbin106576 -> 106432 bytes
-rw-r--r--tex/context/base/context.mkii2
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/core-dat.lua4
-rw-r--r--tex/context/base/pack-com.mkiv21
-rw-r--r--tex/context/base/page-lin.mkiv8
-rw-r--r--tex/context/base/spac-ali.mkiv14
-rw-r--r--tex/context/base/status-files.pdfbin24590 -> 24591 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin196231 -> 196231 bytes
-rw-r--r--tex/context/base/util-sql-imp-library.lua234
-rw-r--r--tex/context/base/x-mathml.lua27
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
15 files changed, 240 insertions, 78 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii
index c6a84db34..484cf93c1 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.10.28 13:23}
+\newcontextversion{2012.10.30 11:35}
%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 c4e31a204..fa996ed90 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.10.28 13:23}
+\newcontextversion{2012.10.30 11:35}
%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 6d9f28098..705151609 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 d3f9c7ee1..9588daaeb 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 e5ff7b84b..ab7d00604 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.10.28 13:23}
+\edef\contextversion{2012.10.30 11:35}
%D For those who want to use this:
diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv
index a1c25d76e..136d7a8c6 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.10.28 13:23}
+\edef\contextversion{2012.10.30 11:35}
%D For those who want to use this:
diff --git a/tex/context/base/core-dat.lua b/tex/context/base/core-dat.lua
index 879ff6130..d81f11a28 100644
--- a/tex/context/base/core-dat.lua
+++ b/tex/context/base/core-dat.lua
@@ -11,7 +11,7 @@ if not modules then modules = { } end modules ['core-dat'] = {
replaces the twopass data mechanism.</p>
--ldx]]--
-local tonumber, type = tonumber, type
+local tonumber, tostring, type = tonumber, tostring, type
local context, commands = context, commands
@@ -161,7 +161,7 @@ function commands.datasetvariable(name,tag,key)
if trace_datasets then
report_dataset("unknown: name %s with tag %s (not passed to tex)",name,tag)
end
- elseif type(t) ~= "table" then
+ elseif type(t) == "table" then
local s = t[key]
if type(s) ~= "table" then
context(tostring(s))
diff --git a/tex/context/base/pack-com.mkiv b/tex/context/base/pack-com.mkiv
index fbc2b2732..d0768d97c 100644
--- a/tex/context/base/pack-com.mkiv
+++ b/tex/context/base/pack-com.mkiv
@@ -152,6 +152,11 @@
%
% faster
+\unexpanded\def\pack_common_content_start{\bgroup\ignorespaces}
+\unexpanded\def\pack_common_content_stop {\removeunwantedspaces\egroup}
+\unexpanded\def\pack_common_caption_start{\bgroup\ignorespaces}
+\unexpanded\def\pack_common_caption_stop {\removeunwantedspaces\egroup}
+
\unexpanded\def\stopcombination
{\bgroup\normalexpanded{\egroup{}\ctxcommand{ntimes("{}{}",\number\c_pack_combinations_n)}}%
\dostoptagged
@@ -177,10 +182,10 @@
%
\forgetall
%
- \let\startcontent\bgroup
- \let\stopcontent \egroup
- \let\startcaption\bgroup
- \let\stopcaption \egroup
+ \let\startcontent\pack_common_content_start
+ \let\stopcontent \pack_common_content_stop
+ \let\startcaption\pack_common_caption_start
+ \let\stopcaption \pack_common_caption_stop
%
\edef\p_height {\combinationparameter\c!height}%
\edef\p_width {\combinationparameter\c!width}%
@@ -562,10 +567,10 @@
\edef\p_location{\pairedboxparameter\c!location}%
\edef\p_n {\pairedboxparameter\c!n}%
%
- \let\startcontent\bgroup
- \let\stopcontent \egroup
- \let\startcaption\bgroup
- \let\stopcaption \egroup
+ \let\startcontent\pack_common_content_start
+ \let\stopcontent \pack_common_content_stop
+ \let\startcaption\pack_common_caption_start
+ \let\stopcaption \pack_common_caption_stop
%
\global\setsystemmode{pairedbox}%
\pack_pairedboxes_before
diff --git a/tex/context/base/page-lin.mkiv b/tex/context/base/page-lin.mkiv
index dd13fb87d..f20e08c98 100644
--- a/tex/context/base/page-lin.mkiv
+++ b/tex/context/base/page-lin.mkiv
@@ -222,8 +222,8 @@
\letlinenumberingparameter\c!start\m_argument}
{\let\currentlinenumbering\m_argument}}%
\fi
- \edef\m_argument{\linenumberingparameter\c!continue}%
- \ifx\m_argument\v!continue
+ \edef\p_continue{\linenumberingparameter\c!continue}%
+ \ifx\p_continue\v!continue
\c_page_lines_mode\zerocount
\fi
\fi
@@ -242,8 +242,8 @@
{\doifnumber\m_argument
{\letlinenumberingparameter\c!start\m_argument}}%
\fi
- \edef\m_argument{\linenumberingparameter\c!continue}%
- \ifx\m_argument\v!continue
+ \edef\p_continue{\linenumberingparameter\c!continue}%
+ \ifx\p_continue\v!continue
\c_page_lines_mode\zerocount
\fi
\fi
diff --git a/tex/context/base/spac-ali.mkiv b/tex/context/base/spac-ali.mkiv
index 100e3ab82..c0a503d85 100644
--- a/tex/context/base/spac-ali.mkiv
+++ b/tex/context/base/spac-ali.mkiv
@@ -817,7 +817,7 @@
\dontleavehmode % added in marrakesch at TUG 2006\begingroup
\begingroup
\setlocalhsize % new
- \def\\{\endgroup\par\doalignline{#1}{#2}\begingroup}%
+ \def\\{\egroup\par\doalignline{#1}{#2}\bgroup}%
\dowithnextbox
{\hbox to \localhsize
{\ifcase\alignstrutmode\or\strut\fi
@@ -841,6 +841,16 @@
\unexpanded\def\rightaligned{\doalignline\hss \relax}
\unexpanded\def\maxaligned {\doalignline\relax \relax}
+\unexpanded\def\startleftaligned {\doalignline\relax \hss \bgroup\ignorespaces}
+\unexpanded\def\startmidaligned {\doalignline\hss \hss \bgroup\ignorespaces}
+\unexpanded\def\startrightaligned{\doalignline\hss \relax\bgroup\ignorespaces}
+\unexpanded\def\startmaxaligned {\doalignline\relax \relax\bgroup\ignorespaces}
+
+\unexpanded\def\stopleftaligned {\removeunwantedspaces\egroup}
+\unexpanded\def\stopmidaligned {\removeunwantedspaces\egroup}
+\unexpanded\def\stoprightaligned{\removeunwantedspaces\egroup}
+\unexpanded\def\stopmaxaligned {\removeunwantedspaces\egroup}
+
\let\centeraligned\midaligned
\installcorenamespace{alignline}
@@ -863,7 +873,7 @@
\dontleavehmode % added in marrakesch at TUG 2006\begingroup
\begingroup
\setlocalhsize
- \def\\{\endgroup\par\doxalignline#1#2#3#4#5#6\begingroup}% inefficient
+ \def\\{\egroup\par\doxalignline#1#2#3#4#5#6\bgroup}% inefficient
\dowithnextbox
{\hbox to \localhsize
{#1\hskip\ifdone#2\else#3\fi#4%
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 352eea4d5..477acff92 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 974d6c88d..f6fbe46b8 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/util-sql-imp-library.lua b/tex/context/base/util-sql-imp-library.lua
index a32a9d09b..90b6be5fb 100644
--- a/tex/context/base/util-sql-imp-library.lua
+++ b/tex/context/base/util-sql-imp-library.lua
@@ -91,10 +91,137 @@ local function connect(session,specification)
)
end
-local function datafetched(specification,query,converter)
+-- local function datafetched(specification,query,converter)
+-- if not query or query == "" then
+-- report_state("no valid query")
+-- return { }, { }
+-- end
+-- local id = specification.id
+-- local session, connection
+-- if id then
+-- local c = cache[id]
+-- if c then
+-- session = c.session
+-- connection = c.connection
+-- end
+-- if not connection then
+-- session = initialize()
+-- connection = connect(session,specification)
+-- cache[id] = { session = session, connection = connection }
+-- end
+-- else
+-- session = initialize()
+-- connection = connect(session,specification)
+-- end
+-- if not connection then
+-- report_state("error in connection: %s@%s to %s:%s",
+-- specification.database or "no database",
+-- specification.username or "no username",
+-- specification.host or "no host",
+-- specification.port or "no port"
+-- )
+-- return { }, { }
+-- end
+-- query = lpegmatch(querysplitter,query)
+-- local result, message, okay
+-- -- todo: check if open !
+-- for i=1,#query do
+-- local q = query[i]
+-- local r, m = connection:execute(q)
+-- if m then
+-- report_state("error in query, stage 1: %s",string.collapsespaces(q))
+-- message = message and format("%s\n%s",message,m) or m
+-- end
+-- local t = type(r)
+-- if t == "userdata" then
+-- result = r
+-- okay = true
+-- elseif t == "number" then
+-- okay = true
+-- end
+-- end
+-- if not okay and id then -- can go
+-- if session then
+-- session:close()
+-- end
+-- if connection then
+-- connection:close()
+-- end
+-- session = initialize() -- maybe not needed
+-- connection = connect(session,specification)
+-- if connection then
+-- cache[id] = { session = session, connection = connection }
+-- for i=1,#query do
+-- local q = query[i]
+-- local r, m = connection:execute(q)
+-- if m then
+-- report_state("error in query, stage 2: %s",string.collapsespaces(q))
+-- message = message and format("%s\n%s",message,m) or m
+-- end
+-- local t = type(r)
+-- if t == "userdata" then
+-- result = r
+-- okay = true
+-- elseif t == "number" then
+-- okay = true
+-- end
+-- end
+-- else
+-- message = "unable to connect"
+-- report_state(message)
+-- end
+-- end
+-- local data, keys
+-- if result then
+-- if converter then
+-- data = converter.library(result)
+-- -- data = converter(result)
+-- else
+-- keys = result:getcolnames()
+-- if keys then
+-- local n = result:numrows() or 0
+-- if n == 0 then
+-- data = { }
+-- -- elseif n == 1 then
+-- -- -- data = { result:fetch({},"a") }
+-- else
+-- data = { }
+-- -- for i=1,n do
+-- -- data[i] = result:fetch({},"a")
+-- -- end
+-- local k = #keys
+-- for i=1,n do
+-- local v = { result:fetch() }
+-- local d = { }
+-- for i=1,k do
+-- d[keys[i]] = v[i]
+-- end
+-- data[#data+1] = d
+-- end
+-- end
+-- end
+-- end
+-- result:close()
+-- elseif message then
+-- report_state("message %s",message)
+-- end
+-- if not keys then
+-- keys = { }
+-- end
+-- if not data then
+-- data = { }
+-- end
+-- if not id then
+-- connection:close()
+-- session:close()
+-- end
+-- return data, keys
+-- end
+
+local function fetched(specification,query,converter)
if not query or query == "" then
report_state("no valid query")
- return { }, { }
+ return false
end
local id = specification.id
local session, connection
@@ -106,31 +233,44 @@ local function datafetched(specification,query,converter)
end
if not connection then
session = initialize()
+ if not session then
+ return format("no session for %q",id)
+ end
connection = connect(session,specification)
+ if not connection then
+ return format("no connection for %q",id)
+ end
cache[id] = { session = session, connection = connection }
end
else
session = initialize()
+ if not session then
+ return "no session"
+ end
connection = connect(session,specification)
+ if not connection then
+ return "no connection"
+ end
end
if not connection then
report_state("error in connection: %s@%s to %s:%s",
- specification.database or "no database",
- specification.username or "no username",
- specification.host or "no host",
- specification.port or "no port"
- )
- return { }, { }
+ specification.database or "no database",
+ specification.username or "no username",
+ specification.host or "no host",
+ specification.port or "no port"
+ )
+ return "no connection"
end
query = lpegmatch(querysplitter,query)
- local result, message, okay
- -- todo: check if open !
+ local result, okay
for i=1,#query do
local q = query[i]
local r, m = connection:execute(q)
if m then
report_state("error in query, stage 1: %s",string.collapsespaces(q))
- message = message and format("%s\n%s",message,m) or m
+ if m then
+ report_state("message: %s",m)
+ end
end
local t = type(r)
if t == "userdata" then
@@ -140,55 +280,28 @@ local function datafetched(specification,query,converter)
okay = true
end
end
- if not okay and id then -- can go
+ if not okay then -- can go
if session then
session:close()
end
if connection then
connection:close()
end
- session = initialize() -- maybe not needed
- connection = connect(session,specification)
- if connection then
- cache[id] = { session = session, connection = connection }
- for i=1,#query do
- local q = query[i]
- local r, m = connection:execute(q)
- if m then
- report_state("error in query, stage 2: %s",string.collapsespaces(q))
- message = message and format("%s\n%s",message,m) or m
- end
- local t = type(r)
- if t == "userdata" then
- result = r
- okay = true
- elseif t == "number" then
- okay = true
- end
- end
- else
- message = "unable to connect"
- report_state(message)
+ if id then
+ cache[id] = nil
end
+ return "execution error"
end
local data, keys
if result then
if converter then
data = converter.library(result)
- -- data = converter(result)
else
keys = result:getcolnames()
if keys then
+ data = { }
local n = result:numrows() or 0
- if n == 0 then
- data = { }
- -- elseif n == 1 then
- -- -- data = { result:fetch({},"a") }
- else
- data = { }
- -- for i=1,n do
- -- data[i] = result:fetch({},"a")
- -- end
+ if n > 0 then
local k = #keys
for i=1,n do
local v = { result:fetch() }
@@ -202,20 +315,33 @@ local function datafetched(specification,query,converter)
end
end
result:close()
- elseif message then
- report_state("message %s",message)
end
- if not keys then
- keys = { }
+ if not id then
+ if connection then
+ connection:close()
+ end
+ if session then
+ session:close()
+ end
end
- if not data then
- data = { }
+ return false, data, keys
+end
+
+local function datafetched(specification,query,converter)
+ local callokay, connectionerror, data, keys = pcall(fetched,specification,query,converter)
+ if not callokay then
+ report_state("call error, retrying")
+ callerror, connectionerror, data, keys = pcall(fetched,specification,query,converter)
+ elseif connectionerror then
+ report_state("error: %q, retrying",connectionerror)
+ callerror, connectionerror, data, keys = pcall(fetched,specification,query,converter)
end
- if not id then
- connection:close()
- session:close()
+ if not callokay then
+ report_state("persistent call error")
+ elseif connectionerror then
+ report_state("persistent error: %q",connectionerror)
end
- return data, keys
+ return data or { }, keys or { }
end
local function execute(specification)
diff --git a/tex/context/base/x-mathml.lua b/tex/context/base/x-mathml.lua
index cc7238f94..430122786 100644
--- a/tex/context/base/x-mathml.lua
+++ b/tex/context/base/x-mathml.lua
@@ -106,6 +106,7 @@ local i_replacements = {
["identity"] = "\\mathopnolimits{id}",
["image"] = "\\mathopnolimits{image}",
["lcm"] = "\\mathopnolimits{lcm}",
+ ["lim"] = "\\mathopnolimits{lim}",
["max"] = "\\mathopnolimits{max}",
["median"] = "\\mathopnolimits{median}",
["min"] = "\\mathopnolimits{min}",
@@ -486,12 +487,32 @@ function mathml.mo(id)
context(simpleoperatorremapper(rep))
end
+-- function mathml.mi(id)
+-- local e = getid(id)
+-- local str = e.dt
+-- if type(str) == "string" then -- we need a helper for this in the xml namespace ... xml.type(e)
+-- -- local str = xmlcontent(e) or ""
+-- local str = gsub(str,"&.-;","") -- needed?
+-- local rep = i_replacements[str]
+-- if not rep then
+-- rep = gsub(str,".",i_replacements)
+-- end
+-- context(rep)
+-- -- context.mi(rep)
+-- else
+-- context.xmlflush(id) -- xmlsprint or so
+-- end
+-- end
+
function mathml.mi(id)
+ -- we need to strip comments etc .. todo when reading in tree
local e = getid(id)
local str = e.dt
- if type(str) == "string" then -- we need a helper for this in the xml namespace ... xml.type(e)
- -- local str = xmlcontent(e) or ""
- local str = gsub(str,"&.-;","") -- needed?
+ local n = #str
+ if n == 0 then
+ -- nothing to do
+ elseif n == 1 then
+ local str = gsub(str[1],"&.-;","") -- bah
local rep = i_replacements[str]
if not rep then
rep = gsub(str,".",i_replacements)
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 5f0a7aaa0..6fd66863c 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 : 10/28/12 13:23:51
+-- merge date : 10/30/12 11:35:26
do -- begin closure to overcome local limits and interference