summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/chem-str.lua80
-rw-r--r--tex/context/base/cont-new.mkiv4
-rw-r--r--tex/context/base/context-version.pdfbin4131 -> 4128 bytes
-rw-r--r--tex/context/base/context-version.pngbin40047 -> 40483 bytes
-rw-r--r--tex/context/base/context.mkiv2
-rw-r--r--tex/context/base/data-res.lua5
-rw-r--r--tex/context/base/l-lua.lua13
-rw-r--r--tex/context/base/math-ali.mkiv12
-rw-r--r--tex/context/base/status-files.pdfbin24764 -> 24752 bytes
-rw-r--r--tex/context/base/status-lua.pdfbin211760 -> 211622 bytes
-rw-r--r--tex/context/base/tabl-xtb.lua12
-rw-r--r--tex/context/base/util-lib.lua98
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua14
13 files changed, 171 insertions, 69 deletions
diff --git a/tex/context/base/chem-str.lua b/tex/context/base/chem-str.lua
index 311b70b2d..dfcf0a3e1 100644
--- a/tex/context/base/chem-str.lua
+++ b/tex/context/base/chem-str.lua
@@ -45,6 +45,7 @@ local P, R, S, C, Cs, Ct, Cc, Cmt = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cs, lpe
local variables = interfaces and interfaces.variables
local context = context
local formatters = string.formatters
+local texcount = tex.count
local v_default = variables.default
local v_small = variables.small
@@ -625,6 +626,7 @@ local function checked(d,factor,unit,scale)
end
local function calculated(height,bottom,top,factor,unit,scale)
+ local scaled = 0
if height == v_none then
-- this always wins
height = "0pt"
@@ -654,22 +656,23 @@ local function calculated(height,bottom,top,factor,unit,scale)
bottom = bottom * ratio
top = top * ratio
end
+ scaled = height
top = topoints(top)
bottom = topoints(bottom)
height = topoints(height)
end
- return height, bottom, top
+ return height, bottom, top, scaled
end
function chemistry.start(settings)
- chemistry.structures = chemistry.structures + 1
+ --
+ local width = settings.width or v_fit
+ local height = settings.height or v_fit
local unit = settings.unit or 655360
local factor = settings.factor or 3
local rulethickness = settings.rulethickness or 65536
local rulecolor = settings.rulecolor or ""
local axiscolor = settings.framecolor or ""
- local width = settings.width or v_fit
- local height = settings.height or v_fit
local scale = settings.scale or "normal"
local rotation = settings.rotation or 0
local offset = settings.offset or 0
@@ -678,8 +681,6 @@ function chemistry.start(settings)
local top = settings.top or v_fit
local bottom = settings.bottom or v_fit
--
- metacode = { }
- --
align = settings.symalign or "auto"
if trace_structure then
report_chemistry("unit %p, factor %s, symalign %s",unit,factor,align)
@@ -709,11 +710,26 @@ function chemistry.start(settings)
--
unit = scale * unit
--
- width, left, right = calculated(width, left, right,factor,unit,scale)
- height, bottom, top = calculated(height,bottom,top, factor,unit,scale)
+ local sp_width = 0
+ local sp_height = 0
+ --
+ width, left, right, sp_width = calculated(width, left, right,factor,unit,scale)
+ height, bottom, top, sp_height = calculated(height,bottom,top, factor,unit,scale)
+ --
+ if width ~= "true" and height ~= "true" and texcount["@@trialtypesetting"] ~= 0 then
+ if trace_structure then
+ report_chemistry("skipping trial run")
+ end
+ context.hrule(sp_width,sp_height,0) -- maybe depth
+ return
+ end
+ --
+ chemistry.structures = chemistry.structures + 1
--
rotation = tonumber(rotation) or 0
--
+ metacode = { }
+ --
if trace_structure then
report_chemistry("%s scale %a, rotation %a, width %s, height %s, left %s, right %s, top %s, bottom %s","used",scale,rotation,width,height,left,right,top,bottom)
end
@@ -729,32 +745,36 @@ function chemistry.start(settings)
end
function chemistry.stop()
- metacode[#metacode+1] = f_stop_structure
- local mpcode = concat(metacode,"\n")
- if trace_metapost then
- report_chemistry("metapost code:\n%s", mpcode)
- end
- if metapost.instance(chemistry.instance) then
- f_initialize = nil
+ if metacode then
+ metacode[#metacode+1] = f_stop_structure
+ local mpcode = concat(metacode,"\n")
+ if trace_metapost then
+ report_chemistry("metapost code:\n%s", mpcode)
+ end
+ if metapost.instance(chemistry.instance) then
+ f_initialize = nil
+ end
+ metapost.graphic {
+ instance = chemistry.instance,
+ format = chemistry.format,
+ data = mpcode,
+ definitions = f_initialize,
+ }
+ t_initialize = ""
+ metacode = nil
end
- metapost.graphic {
- instance = chemistry.instance,
- format = chemistry.format,
- data = mpcode,
- definitions = f_initialize,
- }
- t_initialize = ""
- metacode = nil
end
function chemistry.component(spec,text,settings)
- rulethickness, rulecolor, offset = settings.rulethickness, settings.rulecolor
- local spec = settings_to_array_with_repeat(spec,true) -- no lower?
- local text = settings_to_array_with_repeat(text,true)
--- inspect(spec)
- metacode[#metacode+1] = f_start_component
- process(1,spec,text,1,rulethickness,rulecolor) -- offset?
- metacode[#metacode+1] = f_stop_component
+ if metacode then
+ rulethickness, rulecolor, offset = settings.rulethickness, settings.rulecolor
+ local spec = settings_to_array_with_repeat(spec,true) -- no lower?
+ local text = settings_to_array_with_repeat(text,true)
+ -- inspect(spec)
+ metacode[#metacode+1] = f_start_component
+ process(1,spec,text,1,rulethickness,rulecolor) -- offset?
+ metacode[#metacode+1] = f_stop_component
+ end
end
statistics.register("chemical formulas", function()
diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv
index 530058fc9..85a3cf0a5 100644
--- a/tex/context/base/cont-new.mkiv
+++ b/tex/context/base/cont-new.mkiv
@@ -11,14 +11,14 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2013.04.07 14:05}
+\newcontextversion{2013.04.08 17:52}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
\unprotect
-\writestatus\m!system{beware: some patches loaded from cont-new.mkiv}
+% \writestatus\m!system{beware: some patches loaded from cont-new.mkiv}
% \attribute152\zerocount : marks ... lots of sweeps so best early in list
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 27388e1a0..916ff06be 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 a8a38184b..b32e53f50 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.mkiv b/tex/context/base/context.mkiv
index 224944aec..e11a57a4f 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.04.07 14:05}
+\edef\contextversion{2013.04.08 17:52}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/data-res.lua b/tex/context/base/data-res.lua
index f7e238a11..32e19cf13 100644
--- a/tex/context/base/data-res.lua
+++ b/tex/context/base/data-res.lua
@@ -294,8 +294,9 @@ local pathexpressionpattern = Cs ( -- create lpeg instead (2013/2014)
Cc("^") * (
Cc("%") * S(".-")
+ slash^2 * P(-1) / "/.*"
--- + slash^2 / "/.-/"
- + slash^2 / "/[^/]*/*"
+ -- + slash^2 / "/.-/"
+ -- + slash^2 / "/[^/]*/*" -- too general
+ + slash^2 / "/"
+ (1-slash) * P(-1) * Cc("/")
+ P(1)
)^1 * Cc("$") -- yes or no $
diff --git a/tex/context/base/l-lua.lua b/tex/context/base/l-lua.lua
index 538c65d7e..51816400e 100644
--- a/tex/context/base/l-lua.lua
+++ b/tex/context/base/l-lua.lua
@@ -356,7 +356,7 @@ end
local function notloaded(name)
if helpers.trace then
- helpers.report("? unable to locate library '%s'",name)
+ helpers.report("unable to locate library '%s'",name)
end
end
@@ -391,3 +391,14 @@ function helpers.loaded(name)
end
return notloaded(name)
end
+
+function helpers.unload(name)
+ if helpers.trace then
+ if package.loaded[name] then
+ helpers.report("unloading library '%s', %s",name,"done")
+ else
+ helpers.report("unloading library '%s', %s",name,"not loaded")
+ end
+ end
+ package.loaded[name] = nil
+end
diff --git a/tex/context/base/math-ali.mkiv b/tex/context/base/math-ali.mkiv
index a172dc8ae..0d9d38e20 100644
--- a/tex/context/base/math-ali.mkiv
+++ b/tex/context/base/math-ali.mkiv
@@ -231,8 +231,16 @@
\let\align_text_normal_start\startalignment
\let\align_text_normal_stop \stopalignment
- \unexpanded\def\startalign{\ifmmode\expandafter\align_math_normal_start\else\expandafter\align_text_normal_start\fi}
- \unexpanded\def\stopalign {\ifmmode\expandafter\align_math_normal_stop \else\expandafter\align_text_normal_stop \fi}
+ \unexpanded\def\startalign
+ {\ifmmode
+ \let\stopalign\align_math_normal_stop % cannot be an unexpanded def ... lookahead in align
+ \expandafter\align_math_normal_start
+ \else
+ \let\stopalign\align_text_normal_stop
+ \expandafter\align_text_normal_start
+ \fi}
+
+ \let\stopalign\relax
\let\startalignment\startalign
\let\stopalignment \stopalign
diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf
index 23ddb60cc..f43bcdc4e 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 19f6e0668..f34d626b7 100644
--- a/tex/context/base/status-lua.pdf
+++ b/tex/context/base/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/tabl-xtb.lua b/tex/context/base/tabl-xtb.lua
index cf9a4a0a6..59cfadbf2 100644
--- a/tex/context/base/tabl-xtb.lua
+++ b/tex/context/base/tabl-xtb.lua
@@ -59,6 +59,7 @@ local nodepool = nodes.pool
local new_glue = nodepool.glue
local new_kern = nodepool.kern
local new_penalty = nodepool.penalty
+local new_hlist = nodepool.hlist
local v_stretch = variables.stretch
local v_normal = variables.normal
@@ -645,10 +646,13 @@ function xtables.construct()
local list = drc.list
if list then
list.shift = list.height + list.depth
- list = hpack_node_list(list) -- is somehow needed
- list.width = 0
- list.height = 0
- list.depth = 0
+-- list = hpack_node_list(list) -- is somehow needed
+-- list.width = 0
+-- list.height = 0
+-- list.depth = 0
+local h = new_hlist()
+h.list = list
+list = h
if start then
stop.next = list
list.prev = stop
diff --git a/tex/context/base/util-lib.lua b/tex/context/base/util-lib.lua
index fde1f987e..601f2fb1d 100644
--- a/tex/context/base/util-lib.lua
+++ b/tex/context/base/util-lib.lua
@@ -65,6 +65,12 @@ or not using a wildcard lookup.
This code is experimental and by providing a special abstract loader (called
swiglib) we can start using the libraries.
+A complication is that we might end up with a luajittex path matching before a
+luatex path due to the path spec. One solution is to first check with the engine
+prefixed. This could be prevented by a more strict lib pattern but that is not
+always under our control. So, we first check for paths with engine in their name
+and then without.
+
]]--
-- seems to be clua in recent texlive
@@ -81,6 +87,8 @@ local trace_swiglib = false trackers.register("resolvers.swiglib", function(v)
-- We can check if there are more that one component, and if not, we can
-- append 'core'.
+local done = false
+
local function requireswiglib(required,version)
local library = loaded[required]
if library == nil then
@@ -90,35 +98,55 @@ local function requireswiglib(required,version)
local required_base = nameonly(required_full)
local required_name = required_base .. "." .. os.libsuffix
local version = type(version) == "string" and version ~= "" and version or false
- -- helper
+ local engine = environment.ownmain or false
+ --
+ if trace_swiglib and not done then
+ local list = resolvers.expandedpathlistfromvariable("lib")
+ for i=1,#list do
+ report_swiglib("tds path %i: %s",i,list[i])
+ end
+ end
+ -- helpers
+ local function found(locate,asked_library,how,...)
+ if trace_swiglib then
+ report_swiglib("checking %s: %a",how,asked_library)
+ end
+ return locate(asked_library,...)
+ end
local function check(locate,...)
- local found_library = nil
+ local found = nil
if version then
local asked_library = joinfile(required_path,version,required_name)
if trace_swiglib then
report_swiglib("checking %s: %a","with version",asked_library)
end
- found_library = locate(asked_library,...)
- if not found_library or found_library == ""then
- asked_library = joinfile(required_path,required_name)
- if trace_swiglib then
- report_swiglib("checking %s: %a","without version",asked_library)
- end
- found_library = locate(asked_library,...)
- end
- else
+ found = locate(asked_library,...)
+ end
+ if not found or found == "" then
local asked_library = joinfile(required_path,required_name)
if trace_swiglib then
- report_swiglib("checking %s: %a","without version",asked_library)
+ report_swiglib("checking %s: %a","with version",asked_library)
end
- found_library = locate(asked_library,...)
+ found = locate(asked_library,...)
end
- return found_library and found_library ~= "" and found_library or false
+ return found and found ~= "" and found or false
end
- -- check cnf spec using name and version
- local found_library = findfile and check(findfile,"lib")
- -- check cnf spec using wildcard
- if findfiles and not found_library then
+ -- Alternatively we could first collect the locations and then do the two attempts
+ -- on this list but in practice this is not more efficient as we might have a fast
+ -- match anyway.
+ local function attempt(checkpattern)
+ -- check cnf spec using name and version
+ if trace_swiglib then
+ report_swiglib("checking tds lib paths strictly")
+ end
+ local found = findfile and check(findfile,"lib")
+ if found and (not checkpattern or find(found,checkpattern)) then
+ return found
+ end
+ -- check cnf spec using wildcard
+ if trace_swiglib then
+ report_swiglib("checking tds lib paths with wildcard")
+ end
local asked_library = joinfile(required_path,".*",required_name)
if trace_swiglib then
report_swiglib("checking %s: %a","latest version",asked_library)
@@ -126,19 +154,39 @@ local function requireswiglib(required,version)
local list = findfiles(asked_library,"lib",true)
if list and #list > 0 then
table.sort(list)
- found_library = list[#list]
+ local found = list[#list]
+ if found and (not checkpattern or find(found,checkpattern)) then
+ return found
+ end
+ end
+ -- Check clib paths using name and version.
+ if trace_swiglib then
+ report_swiglib("checking clib paths")
end
- end
- -- check clib paths using name and version
- if not found_library then
package.extraclibpath(environment.ownpath)
local paths = package.clibpaths()
for i=1,#paths do
- local found_library = check(lfs.isfile)
- if found_library then
- break
+ local found = check(lfs.isfile)
+ if found and (not checkpattern or find(found,checkpattern)) then
+ return found
end
end
+ return false
+ end
+ local found_library = nil
+ if engine then
+ if trace_swiglib then
+ report_swiglib("attemp 1, engine %a",engine)
+ end
+ found_library = attempt("/"..engine.."/")
+ if not found_library then
+ if trace_swiglib then
+ report_swiglib("attemp 2, no engine",asked_library)
+ end
+ found_library = attempt()
+ end
+ else
+ found_library = attempt()
end
-- load and initialize when found
if not found_library then
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 2cb036df0..dff2d3975 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 : 04/07/13 14:05:24
+-- merge date : 04/08/13 17:52:17
do -- begin closure to overcome local limits and interference
@@ -193,7 +193,7 @@ local function loadedbypath(name,rawname,paths,islib,what)
end
local function notloaded(name)
if helpers.trace then
- helpers.report("? unable to locate library '%s'",name)
+ helpers.report("unable to locate library '%s'",name)
end
end
helpers.loadedaslib=loadedaslib
@@ -224,6 +224,16 @@ function helpers.loaded(name)
end
return notloaded(name)
end
+function helpers.unload(name)
+ if helpers.trace then
+ if package.loaded[name] then
+ helpers.report("unloading library '%s', %s",name,"done")
+ else
+ helpers.report("unloading library '%s', %s",name,"not loaded")
+ end
+ end
+ package.loaded[name]=nil
+end
end -- closure