From 3dbcef73aec79246dfc4238eb7af28d3fa54e1f3 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 11 Jan 2010 14:57:00 +0100 Subject: beta 2010.01.11 14:57 --- tex/context/base/buff-ini.lua | 26 ++++++++++++++++++++------ tex/context/base/char-cmp.lua | 1 + tex/context/base/data-bin.lua | 1 + tex/context/base/data-lua.lua | 1 + tex/context/base/data-tex.lua | 1 + tex/context/base/data-tre.lua | 1 + tex/context/base/data-zip.lua | 1 + tex/context/base/font-syn.lua | 1 + tex/context/base/l-table.lua | 1 + tex/context/base/luat-ini.lua | 6 +++++- tex/context/base/mult-clm.lua | 1 + tex/context/base/pack-rul.mkiv | 8 ++++---- tex/context/base/pret-lua.lua | 19 ++++++++++++------- tex/context/base/spac-ver.lua | 1 + tex/context/base/strc-des.mkiv | 14 +++++++++----- tex/context/base/strc-not.lua | 6 ++++++ tex/context/base/strc-not.mkiv | 3 ++- tex/generic/context/luatex-fonts-merged.lua | 3 ++- 18 files changed, 70 insertions(+), 25 deletions(-) (limited to 'tex') diff --git a/tex/context/base/buff-ini.lua b/tex/context/base/buff-ini.lua index d6b5211b1..9d8ad8104 100644 --- a/tex/context/base/buff-ini.lua +++ b/tex/context/base/buff-ini.lua @@ -37,6 +37,8 @@ local lpegmatch = lpeg.match local data, flags, hooks, visualizers = buffers.data, buffers.flags, buffers.hooks, buffers.visualizers +visualizers.defaultname = variables.typing + function buffers.raw(name) return data[name] or { } end @@ -350,15 +352,27 @@ function buffers.loadvisualizer(name) if hn then return hn else - if trace_visualize then + environment.loadluafile("pret-" .. name) + local hn = handlers[name] + if not hn then + -- hn = buffers.newvisualizer(name) + hn = handlers[visualizers.defaultname] + handlers[name] = n + if trace_visualize then + logs.report("buffers","mapping '%s' visualizer onto '%s'",name,visualizers.defaultname) + end + elseif trace_visualize then logs.report("buffers","loading '%s' visualizer",name) end - environment.loadluafile("pret-" .. name) - return handlers[name] or buffers.newvisualizer(name) + return hn end end -local default = buffers.newvisualizer("default") +-- was "default", should be set at tex end (todo) + +local default = buffers.newvisualizer(visualizers.defaultname) + +--~ print(variables.typing) os.exit() local currentvisualizer, currenthandler @@ -366,7 +380,7 @@ function buffers.setvisualizer(str) currentvisualizer = lower(str) currenthandler = handlers[currentvisualizer] if not currenthandler then - currentvisualizer = 'default' + currentvisualizer = visualizers.defaultname currenthandler = handlers.default end if currenthandler.reset then @@ -374,7 +388,7 @@ function buffers.setvisualizer(str) end end -buffers.setvisualizer("default") +buffers.setvisualizer(visualizers.defaultname) function visualizers.reset() end diff --git a/tex/context/base/char-cmp.lua b/tex/context/base/char-cmp.lua index 42a354cb8..c7deb7901 100644 --- a/tex/context/base/char-cmp.lua +++ b/tex/context/base/char-cmp.lua @@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['char-cmp'] = { } local utf = unicode.utf8 +local unpack = unpack or table.unpack characters = characters or { } characters.uncomposed = characters.uncomposed or { } diff --git a/tex/context/base/data-bin.lua b/tex/context/base/data-bin.lua index 6e967fb1a..7bfdc7efe 100644 --- a/tex/context/base/data-bin.lua +++ b/tex/context/base/data-bin.lua @@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['data-bin'] = { } local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders +local unpack = unpack or table.unpack function resolvers.findbinfile(filename, filetype) return resolvers.methodhandler('finders',file.collapse_path(filename), filetype) diff --git a/tex/context/base/data-lua.lua b/tex/context/base/data-lua.lua index 3005d5176..af09bbe59 100644 --- a/tex/context/base/data-lua.lua +++ b/tex/context/base/data-lua.lua @@ -13,6 +13,7 @@ if not modules then modules = { } end modules ['data-lua'] = { local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) local gsub = string.gsub +local unpack = unpack or table.unpack local libformats = { 'luatexlibs', 'tex', 'texmfscripts', 'othertextfiles' } -- 'luainputs' local clibformats = { 'lib' } diff --git a/tex/context/base/data-tex.lua b/tex/context/base/data-tex.lua index 0f2be3962..5798ba9f3 100644 --- a/tex/context/base/data-tex.lua +++ b/tex/context/base/data-tex.lua @@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['data-tex'] = { -- special functions that deal with io local format, lower = string.format, string.lower +local unpack = unpack or table.unpack local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) diff --git a/tex/context/base/data-tre.lua b/tex/context/base/data-tre.lua index a56040ccc..ae417b7a7 100644 --- a/tex/context/base/data-tre.lua +++ b/tex/context/base/data-tre.lua @@ -9,6 +9,7 @@ if not modules then modules = { } end modules ['data-tre'] = { -- \input tree://oeps1/**/oeps.tex local find, gsub = string.find, string.gsub +local unpack = unpack or table.unpack local finders, openers, loaders = resolvers.finders, resolvers.openers, resolvers.loaders diff --git a/tex/context/base/data-zip.lua b/tex/context/base/data-zip.lua index 7d2fc8664..aa3740a83 100644 --- a/tex/context/base/data-zip.lua +++ b/tex/context/base/data-zip.lua @@ -7,6 +7,7 @@ if not modules then modules = { } end modules ['data-zip'] = { } local format, find, match = string.format, string.find, string.match +local unpack = unpack or table.unpack local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end) diff --git a/tex/context/base/font-syn.lua b/tex/context/base/font-syn.lua index e3bd85288..b56ea7917 100644 --- a/tex/context/base/font-syn.lua +++ b/tex/context/base/font-syn.lua @@ -15,6 +15,7 @@ local find, gmatch = string.find, string.gmatch local concat, sort, format = table.concat, table.sort, string.format local lpegmatch = lpeg.match local utfgsub, utflower = utf.gsub, utf.lower +local unpack = unpack or table.unpack local trace_names = false trackers.register("fonts.names", function(v) trace_names = v end) local trace_warnings = false trackers.register("fonts.warnings", function(v) trace_warnings = v end) diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua index 70a901e9d..1382f83a3 100644 --- a/tex/context/base/l-table.lua +++ b/tex/context/base/l-table.lua @@ -12,6 +12,7 @@ local concat, sort, insert, remove = table.concat, table.sort, table.insert, tab local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match local getmetatable, setmetatable = getmetatable, setmetatable local type, next, tostring, tonumber, ipairs, pairs = type, next, tostring, tonumber, ipairs, pairs +local unpack = unpack or table.unpack function table.strip(tab) local lst = { } diff --git a/tex/context/base/luat-ini.lua b/tex/context/base/luat-ini.lua index 4138e16af..295a9ab8f 100644 --- a/tex/context/base/luat-ini.lua +++ b/tex/context/base/luat-ini.lua @@ -45,7 +45,7 @@ one.

--ldx]]-- local string, table, lpeg, math, io, system = string, table, lpeg, math, io, system -local next, setfenv = next, setfenv +local next, setfenv = next, setfenv or debug.setfenv local format = string.format local global = _G @@ -78,6 +78,10 @@ local protected = { userdata, thirddata, moduledata = nil, nil, nil +if not setfenv then + texio.write_nl("warning: we need to fix setfenv") +end + function protect(name) if name == "isolateddata" then local t = { } diff --git a/tex/context/base/mult-clm.lua b/tex/context/base/mult-clm.lua index 6e6597e2a..069da8862 100644 --- a/tex/context/base/mult-clm.lua +++ b/tex/context/base/mult-clm.lua @@ -11,6 +11,7 @@ if not modules then modules = { } end modules ['mult-clm'] = { local texsprint, ctxcatcodes, vrbcatcodes = tex.sprint, tex.ctxcatcodes, tex.vrbcatcodes local format, insert, remove, concat = string.format, table.insert, table.remove, table.concat +local unpack = unpack or table.unpack local trace_define = false trackers.register("context.define", function(v) trace_define = v end) diff --git a/tex/context/base/pack-rul.mkiv b/tex/context/base/pack-rul.mkiv index b0b2592b5..79daf99e2 100644 --- a/tex/context/base/pack-rul.mkiv +++ b/tex/context/base/pack-rul.mkiv @@ -2654,9 +2654,9 @@ \c!orientation=, \c!indenting=, #2]% - \setvalue{\e!start#1}{\dostartframedtext[#1]}% - \setvalue{\e!stop #1}{\dostopframedtext }% - \setvalue {#1}{\doframedtext [#1]}} + \unexpanded\setvalue{\e!start#1}{\dostartframedtext[#1]}% + \unexpanded\setvalue{\e!stop #1}{\dostopframedtext }% + \unexpanded\setvalue {#1}{\doframedtext [#1]}} \def\defineframedtext {\dodoubleempty\dodefineframedtext} @@ -2832,7 +2832,7 @@ \def\dodefineframed[#1][#2]% {\iffirstargument - \setvalue{#1}{\dodoubleempty\doframed[#2]}% + \unexpanded\setvalue{#1}{\dodoubleempty\doframed[#2]}% \fi} \def\doframed[#1][#2]% diff --git a/tex/context/base/pret-lua.lua b/tex/context/base/pret-lua.lua index 1a771a7fd..2809a1eca 100644 --- a/tex/context/base/pret-lua.lua +++ b/tex/context/base/pret-lua.lua @@ -33,9 +33,11 @@ visualizer.identifiers.base = { } visualizer.identifiers.five = { - "_G", "getfenv", "getmetatable", "ipairs", "loadlib", "next", "pairs", - "pcall", "rawequal", "setfenv", "setmetatable", "xpcall", "string", "table", - "math", "coroutine", "io", "os", "debug", "load", "module", "select" + "_G", "getmetatable", "ipairs", "loadlib", "next", "pairs", + "pcall", "rawequal", "setmetatable", "xpcall", "string", "table", + "math", "coroutine", "io", "os", "debug", "load", "module", "select", + -- depricated + "getfenv", "setfenv", } visualizer.identifiers.libs = { @@ -43,7 +45,7 @@ visualizer.identifiers.libs = { "coroutine.create", "coroutine.resume", "coroutine.status", "coroutine.wrap", "coroutine.yield", "coroutine.running", -- package - "package.cpath", "package.loaded", "package.loadlib", "package.path", + "package.cpath", "package.loaded", "package.loadlib", "package.path", "package.config", -- io "io.close", "io.flush", "io.input", "io.lines", "io.open", "io.output", "io.read", "io.tmpfile", "io.type", "io.write", "io.stdin", "io.stdout", @@ -51,7 +53,7 @@ visualizer.identifiers.libs = { -- math "math.abs", "math.acos", "math.asin", "math.atan", "math.atan2", "math.ceil", "math.cos", "math.deg", "math.exp", "math.floor math.", "math.ldexp", - "math.log", "math.log10", "math.max", "math.min math.mod math.pi", "math.pow", + "math.log", "math.max", "math.min", "math.mod", "math.pi", "math.pow", "math.rad", "math.random", "math.randomseed", "math.sin", "math.sqrt", "math.tan", "math.cosh", "math.fmod", "math.modf", "math.sinh", "math.tanh", "math.huge", @@ -60,13 +62,16 @@ visualizer.identifiers.libs = { "string.lower", "string.rep", "string.sub", "string.upper", "string.format", "string.gfind", "string.gsub", "string.gmatch", "string.match", "string.reverse", -- table - "table.maxn", "table.concat", "table.foreach", "table.foreachi", "table.getn", + "table.concat", "table.foreach", "table.foreachi", "table.getn", "table.sort", "table.insert", "table.remove", "table.setn", + "table.pack", "table.unpack", -- os "os.clock", "os.date", "os.difftime", "os.execute", "os.exit", "os.getenv", "os.remove", "os.rename", "os.setlocale", "os.time", "os.tmpname", -- package - "package.preload", "package.seeall" + "package.preload", "package.seeall", + -- depricated + "math.log10", "table.maxn", } local known_words = { } diff --git a/tex/context/base/spac-ver.lua b/tex/context/base/spac-ver.lua index 8700eccce..97114c1e6 100644 --- a/tex/context/base/spac-ver.lua +++ b/tex/context/base/spac-ver.lua @@ -20,6 +20,7 @@ local format, gmatch, concat, match = string.format, string.gmatch, table.concat local ceil, floor, max, min, round = math.ceil, math.floor, math.max, math.min, math.round local texsprint, texlists, texdimen, texbox, texht, texdp = tex.sprint, tex.lists, tex.dimen, tex.box, tex.ht, tex.dp local lpegmatch = lpeg.match +local unpack = unpack or table.unpack local ctxcatcodes = tex.ctxcatcodes local variables = interfaces.variables diff --git a/tex/context/base/strc-des.mkiv b/tex/context/base/strc-des.mkiv index f50688a69..4c823514d 100644 --- a/tex/context/base/strc-des.mkiv +++ b/tex/context/base/strc-des.mkiv @@ -868,14 +868,18 @@ userdata = structure.helpers.touserdata(\!!bs\detokenize{#2}\!!es) } }}% - \xdef\currentdescriptionattribute {\ctxlua {tex.write(jobreferences.setinternalreference("\referenceprefix","\currentdescriptionreference",\nextinternalreference,"\@@iafocus"))}}% - \xdef\currentdescriptionsynchronize{\ctxlatelua{structure.lists.enhance(\currentdescriptionnumberentry)}}% + \xdef\currentdescriptionattribute {\ctxlua {tex.write(jobreferences.setinternalreference("\referenceprefix","\currentdescriptionreference",\nextinternalreference,"\@@iafocus"))}}% + \xdef\currentdescriptionsynchronize{\ctxlatelua{structure.lists.enhance(\currentdescriptionnumberentry)}}% \fi \endgroup} -\def\reinstatedescriptionnumberentry - {\xdef\currentdescriptionattribute {\ctxlua {tex.write(jobreferences.getinternalreference(\currentdescriptionnumberentry))}}% - \xdef\currentdescriptionsynchronize{\ctxlatelua{structure.lists.enhance(\currentdescriptionnumberentry)}}} +% This is not so nice, some day i'll just store the number with the entry +% and deal with all at the Lua end, but first we need to be able to set +% macros. + +\def\reinstatedescriptionnumberentry#1% + {\xdef\currentdescriptionattribute {\ctxlua {tex.write(jobreferences.getinternalreference(#1))}}% + \xdef\currentdescriptionsynchronize{\ctxlatelua{structure.lists.enhance(#1)}}} \installstructurelistprocessor{description}{\usestructurelistprocessor{number+title}} diff --git a/tex/context/base/strc-not.lua b/tex/context/base/strc-not.lua index 266e22edc..f390c05b5 100644 --- a/tex/context/base/strc-not.lua +++ b/tex/context/base/strc-not.lua @@ -69,6 +69,12 @@ function notes.get(tag,n) end end +-- we could make a special enhancer + +function notes.listindex(tag,n) + return notedata[tag][n] +end + function notes.define(tag,kind,number) local state = notes.setstate(tag,kind) state.number = number diff --git a/tex/context/base/strc-not.mkiv b/tex/context/base/strc-not.mkiv index cbdf3783f..6be959fa3 100644 --- a/tex/context/base/strc-not.mkiv +++ b/tex/context/base/strc-not.mkiv @@ -640,9 +640,10 @@ {\edef\currentdescription{#1}% \edef\currentnote{#1}% \edef\currentdescriptionnumberentry{#2}% + \edef\currentdescriptionlistentry{\ctxlua{tex.write(structure.notes.listindex("#1",#2))}}% % as we can have collected notes (e.g. in tables) we need to recover % \currentdescriptionattribute and \currentdescriptionsynchronize - \reinstatedescriptionnumberentry + \reinstatedescriptionnumberentry\currentdescriptionlistentry % we could store the number in the entry % \dontcomplain % should be done in startstoreddescription instead \dostartstoreddescription\begstrut\currentnotedescriptiontext\endstrut\dostopstoreddescription} diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua index 56c7c59d5..3d48a017d 100644 --- a/tex/generic/context/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua --- merge date : 01/09/10 00:02:29 +-- merge date : 01/11/10 15:01:58 do -- begin closure to overcome local limits and interference @@ -584,6 +584,7 @@ local concat, sort, insert, remove = table.concat, table.sort, table.insert, tab local format, find, gsub, lower, dump, match = string.format, string.find, string.gsub, string.lower, string.dump, string.match local getmetatable, setmetatable = getmetatable, setmetatable local type, next, tostring, tonumber, ipairs, pairs = type, next, tostring, tonumber, ipairs, pairs +local unpack = unpack or table.unpack function table.strip(tab) local lst = { } -- cgit v1.2.3