diff options
author | Marius <mariausol@gmail.com> | 2013-02-05 23:40:23 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2013-02-05 23:40:23 +0200 |
commit | 298e57104a0c60ee6fbf14ff67b9515512a8b7cd (patch) | |
tree | 6b0c72f14b2d88565b980f1474240062c8136e2d /tex | |
parent | 4da65414b21ec97421091a2df4306455f8ed1146 (diff) | |
download | context-298e57104a0c60ee6fbf14ff67b9515512a8b7cd.tar.gz |
beta 2013.02.05 22:32
Diffstat (limited to 'tex')
-rw-r--r-- | tex/context/base/cont-new.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/cont-new.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/context-version.pdf | bin | 4107 -> 4098 bytes | |||
-rw-r--r-- | tex/context/base/context-version.png | bin | 40160 -> 40164 bytes | |||
-rw-r--r-- | tex/context/base/context.mkii | 2 | ||||
-rw-r--r-- | tex/context/base/context.mkiv | 2 | ||||
-rw-r--r-- | tex/context/base/math-vfu.lua | 82 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24719 -> 24751 bytes | |||
-rw-r--r-- | tex/context/base/status-lua.pdf | bin | 208685 -> 208561 bytes | |||
-rw-r--r-- | tex/context/base/status-mkiv.lua | 7 | ||||
-rw-r--r-- | tex/context/base/util-env.lua | 258 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 2 |
12 files changed, 308 insertions, 49 deletions
diff --git a/tex/context/base/cont-new.mkii b/tex/context/base/cont-new.mkii index ad44564be..6fbd38de4 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.02.05 13:35} +\newcontextversion{2013.02.05 22:32} %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 c91c44933..e5938b11a 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.02.05 13:35} +\newcontextversion{2013.02.05 22:32} %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 Binary files differindex ee4931f5a..81b9897d6 100644 --- a/tex/context/base/context-version.pdf +++ b/tex/context/base/context-version.pdf diff --git a/tex/context/base/context-version.png b/tex/context/base/context-version.png Binary files differindex ba3ff464b..ef320e323 100644 --- a/tex/context/base/context-version.png +++ b/tex/context/base/context-version.png diff --git a/tex/context/base/context.mkii b/tex/context/base/context.mkii index 62235cc1c..355dd2c8a 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.02.05 13:35} +\edef\contextversion{2013.02.05 22:32} %D For those who want to use this: diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 64a146e60..3a5f88110 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.02.05 13:35} +\edef\contextversion{2013.02.05 22:32} %D For those who want to use this: diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua index 042b3890b..70d5e5514 100644 --- a/tex/context/base/math-vfu.lua +++ b/tex/context/base/math-vfu.lua @@ -46,36 +46,36 @@ fonts.handlers.vf.math = vfmath local shared = { } ---~ local push, pop, back = { "push" }, { "pop" }, { "slot", 1, 0x2215 } - ---~ local function negate(main,characters,id,size,unicode,basecode) ---~ if not characters[unicode] then ---~ local basechar = characters[basecode] ---~ if basechar then ---~ local ht, wd = basechar.height, basechar.width ---~ characters[unicode] = { ---~ width = wd, ---~ height = ht, ---~ depth = basechar.depth, ---~ italic = basechar.italic, ---~ kerns = basechar.kerns, ---~ commands = { ---~ { "slot", 1, basecode }, ---~ push, ---~ { "down", ht/5}, ---~ { "right", - wd/2}, ---~ back, ---~ push, ---~ } ---~ } ---~ end ---~ end ---~ end - ---~ \Umathchardef\braceld="0 "1 "FF07A ---~ \Umathchardef\bracerd="0 "1 "FF07B ---~ \Umathchardef\bracelu="0 "1 "FF07C ---~ \Umathchardef\braceru="0 "1 "FF07D +-- local push, pop, back = { "push" }, { "pop" }, { "slot", 1, 0x2215 } +-- +-- local function negate(main,characters,id,size,unicode,basecode) +-- if not characters[unicode] then +-- local basechar = characters[basecode] +-- if basechar then +-- local ht, wd = basechar.height, basechar.width +-- characters[unicode] = { +-- width = wd, +-- height = ht, +-- depth = basechar.depth, +-- italic = basechar.italic, +-- kerns = basechar.kerns, +-- commands = { +-- { "slot", 1, basecode }, +-- push, +-- { "down", ht/5}, +-- { "right", - wd/2}, +-- back, +-- push, +-- } +-- } +-- end +-- end +-- end +-- +-- \Umathchardef\braceld="0 "1 "FF07A +-- \Umathchardef\bracerd="0 "1 "FF07B +-- \Umathchardef\bracelu="0 "1 "FF07C +-- \Umathchardef\braceru="0 "1 "FF07D local function brace(main,characters,id,size,unicode,first,rule,left,right,rule,last) if not characters[unicode] then @@ -140,10 +140,10 @@ end local push, pop, step = { "push" }, { "pop" }, 0.2 -- 0.1 is nicer but gives larger files local function make(main,characters,id,size,n,m) - local old = 0xFF000+n + local old = 0xFF000 + n local c = characters[old] if c then - local upslot, dnslot, uprule, dnrule = 0xFF100+n, 0xFF200+n, 0xFF300+m, 0xFF400+m + local upslot, dnslot, uprule, dnrule = 0xFF100 + n, 0xFF200 + n, 0xFF300 + m, 0xFF400 + m local xu = main.parameters.x_height + 0.3*size local xd = 0.3*size local w, h, d = c.width, c.height, c.depth @@ -755,7 +755,7 @@ function vfmath.define(specification,set,goodies) if italic and italic > 0 then -- int_a^b if isextension then -width = width + italic -- for obscure reasons the integral as a width + italic correction + width = width + italic -- for obscure reasons the integral as a width + italic correction end end if kerns then @@ -774,7 +774,6 @@ width = width + italic -- for obscure reasons the integral as a width + italic c height = fci.height, depth = fci.depth, italic = italic, --- italic_correction = italic, kerns = krn, commands = ref, } @@ -791,11 +790,9 @@ width = width + italic -- for obscure reasons the integral as a width + italic c height = fci.height, depth = fci.depth, italic = italic, --- italic_correction = italic, commands = ref, } end ---~ report_virtual("%05X %s %s",unicode,fci.height or "NO HEIGHT",fci.depth or "NO DEPTH") end end if isextension then @@ -811,12 +808,10 @@ width = width + italic -- for obscure reasons the integral as a width + italic c end local italic = fci.italic local t = { --- width = fci.width + italic, -- watch this ! width = fci.width, height = fci.height, depth = fci.depth, italic = italic, --- italic_correction = italic, commands = ref, } local n = fci.next @@ -871,9 +866,9 @@ width = width + italic -- for obscure reasons the integral as a width + italic c local kerns = fci.kerns if kerns then local krn = { } ---~ for k=1,#kerns do ---~ krn[offset + k] = kerns[k] ---~ end + -- for k=1,#kerns do + -- krn[offset + k] = kerns[k] + -- end for k, v in next, kerns do -- is kerns sparse? krn[offset + k] = v end @@ -882,7 +877,6 @@ width = width + italic -- for obscure reasons the integral as a width + italic c height = fci.height, depth = fci.depth, italic = fci.italic, --- italic_correction = italic, commands = ref, kerns = krn, next = offset + index, @@ -893,7 +887,6 @@ width = width + italic -- for obscure reasons the integral as a width + italic c height = fci.height, depth = fci.depth, italic = fci.italic, --- italic_correction = italic, commands = ref, next = offset + index, } @@ -915,6 +908,8 @@ width = width + italic -- for obscure reasons the integral as a width + italic c size = size, } -- +-- inspect(characters[0x0221A]) + -- main.mathparameters = mathparameters -- still traditional ones vfmath.addmissing(main,#fontlist,size) mathematics.addfallbacks(main) @@ -923,7 +918,6 @@ width = width + italic -- for obscure reasons the integral as a width + italic c fonts.constructors.assignmathparameters(main,main) -- main.MathConstants = main.mathparameters -- we directly pass it to TeX (bypasses the scaler) so this is needed --- inspect(main.MathConstants) -- if trace_virtual or trace_timings then report_virtual("loading and virtualizing font %s at size %s took %0.3f seconds",name,size,os.clock()-start) diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 26f01897e..148b8568f 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf Binary files differindex d4b7fb4c5..470c46144 100644 --- a/tex/context/base/status-lua.pdf +++ b/tex/context/base/status-lua.pdf diff --git a/tex/context/base/status-mkiv.lua b/tex/context/base/status-mkiv.lua index e2e61f8bc..2e833c3da 100644 --- a/tex/context/base/status-mkiv.lua +++ b/tex/context/base/status-mkiv.lua @@ -3562,6 +3562,13 @@ return { }, { category = "lua", + comment = "will be upgraded when we have Lua 5.2", + filename = "util-env", + loading = "luat-lib", + status = "pending", + }, + { + category = "lua", filename = "luat-iop", loading = "luat-lib", status = "okay", diff --git a/tex/context/base/util-env.lua b/tex/context/base/util-env.lua new file mode 100644 index 000000000..283b91c0a --- /dev/null +++ b/tex/context/base/util-env.lua @@ -0,0 +1,258 @@ +if not modules then modules = { } end modules ['util-env'] = { + version = 1.001, + comment = "companion to luat-lib.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local allocate, mark = utilities.storage.allocate, utilities.storage.mark + +local format, sub, match, gsub, find = string.format, string.sub, string.match, string.gsub, string.find +local unquoted, quoted = string.unquoted, string.quoted +local concat, insert, remove = table.concat, table.insert, table.remove + +environment = environment or { } +local environment = environment + +-- precautions + +os.setlocale(nil,nil) -- useless feature and even dangerous in luatex + +function os.setlocale() + -- no way you can mess with it +end + +-- dirty tricks (we will replace the texlua call by luatex --luaonly) + +local validengines = allocate { + ["luatex"] = true, + ["luajittex"] = true, + -- ["luatex.exe"] = true, + -- ["luajittex.exe"] = true, +} + +local basicengines = allocate { + ["luatex"] = "luatex", + ["texlua"] = "luatex", + ["texluac"] = "luatex", + ["luajittex"] = "luajittex", + ["texluajit"] = "luajittex", + -- ["texlua.exe"] = "luatex", + -- ["texluajit.exe"] = "luajittex", +} + +local luaengines=allocate { + ["lua"] = true, + ["luajit"] = true, +} + +environment.validengines = validengines +environment.basicengines = basicengines + +-- [-1] = binary +-- [ 0] = self +-- [ 1] = argument 1 ... + +-- instead we could set ranges + +if not arg then + -- used as library +elseif luaengines[file.removesuffix(arg[-1])] then +-- arg[-1] = arg[0] +-- arg[ 0] = arg[1] +-- for k=2,#arg do +-- arg[k-1] = arg[k] +-- end +-- remove(arg) -- last +elseif validengines[file.removesuffix(arg[0])] then + if arg[1] == "--luaonly" then + arg[-1] = arg[0] + arg[ 0] = arg[2] + for k=3,#arg do + arg[k-2] = arg[k] + end + remove(arg) -- last + remove(arg) -- pre-last + else + -- tex run + end + + -- This is an ugly hack but it permits symlinking a script (say 'context') to 'mtxrun' as in: + -- + -- ln -s /opt/minimals/tex/texmf-linux-64/bin/mtxrun context + -- + -- The special mapping hack is needed because 'luatools' boils down to 'mtxrun --script base' + -- but it's unlikely that there will be more of this + + local originalzero = file.basename(arg[0]) + local specialmapping = { luatools == "base" } + + if originalzero ~= "mtxrun" and originalzero ~= "mtxrun.lua" then + arg[0] = specialmapping[originalzero] or originalzero + insert(arg,0,"--script") + insert(arg,0,"mtxrun") + end + +end + +-- environment + +environment.arguments = allocate() +environment.files = allocate() +environment.sortedflags = nil + +-- context specific arguments (in order not to confuse the engine) + +function environment.initializearguments(arg) + local arguments, files = { }, { } + environment.arguments, environment.files, environment.sortedflags = arguments, files, nil + for index=1,#arg do + local argument = arg[index] + if index > 0 then + local flag, value = match(argument,"^%-+(.-)=(.-)$") + if flag then + flag = gsub(flag,"^c:","") + arguments[flag] = unquoted(value or "") + else + flag = match(argument,"^%-+(.+)") + if flag then + flag = gsub(flag,"^c:","") + arguments[flag] = true + else + files[#files+1] = argument + end + end + end + end + environment.ownname = file.reslash(environment.ownname or arg[0] or 'unknown.lua') +end + +function environment.setargument(name,value) + environment.arguments[name] = value +end + +-- todo: defaults, better checks e.g on type (boolean versus string) +-- +-- tricky: too many hits when we support partials unless we add +-- a registration of arguments so from now on we have 'partial' + +function environment.getargument(name,partial) + local arguments, sortedflags = environment.arguments, environment.sortedflags + if arguments[name] then + return arguments[name] + elseif partial then + if not sortedflags then + sortedflags = allocate(table.sortedkeys(arguments)) + for k=1,#sortedflags do + sortedflags[k] = "^" .. sortedflags[k] + end + environment.sortedflags = sortedflags + end + -- example of potential clash: ^mode ^modefile + for k=1,#sortedflags do + local v = sortedflags[k] + if find(name,v) then + return arguments[sub(v,2,#v)] + end + end + end + return nil +end + +environment.argument = environment.getargument + +function environment.splitarguments(separator) -- rather special, cut-off before separator + local done, before, after = false, { }, { } + local originalarguments = environment.originalarguments + for k=1,#originalarguments do + local v = originalarguments[k] + if not done and v == separator then + done = true + elseif done then + after[#after+1] = v + else + before[#before+1] = v + end + end + return before, after +end + +function environment.reconstructcommandline(arg,noquote) + arg = arg or environment.originalarguments + if noquote and #arg == 1 then + -- we could just do: return unquoted(resolvers.resolve(arg[i])) + local a = arg[1] + a = resolvers.resolve(a) + a = unquoted(a) + return a + elseif #arg > 0 then + local result = { } + for i=1,#arg do + -- we could just do: result[#result+1] = format("%q",unquoted(resolvers.resolve(arg[i]))) + local a = arg[i] + a = resolvers.resolve(a) + a = unquoted(a) + a = gsub(a,'"','\\"') -- tricky + if find(a," ") then + result[#result+1] = quoted(a) + else + result[#result+1] = a + end + end + return concat(result," ") + else + return "" + end +end + +-- -- to be tested: +-- +-- function environment.reconstructcommandline(arg,noquote) +-- arg = arg or environment.originalarguments +-- if noquote and #arg == 1 then +-- return unquoted(resolvers.resolve(arg[1])) +-- elseif #arg > 0 then +-- local result = { } +-- for i=1,#arg do +-- result[#result+1] = format("%q",unquoted(resolvers.resolve(arg[i]))) -- always quote +-- end +-- return concat(result," ") +-- else +-- return "" +-- end +-- end + +if arg then + + -- new, reconstruct quoted snippets (maybe better just remove the " then and add them later) + local newarg, instring = { }, false + + for index=1,#arg do + local argument = arg[index] + if find(argument,"^\"") then + newarg[#newarg+1] = gsub(argument,"^\"","") + if not find(argument,"\"$") then + instring = true + end + elseif find(argument,"\"$") then + newarg[#newarg] = newarg[#newarg] .. " " .. gsub(argument,"\"$","") + instring = false + elseif instring then + newarg[#newarg] = newarg[#newarg] .. " " .. argument + else + newarg[#newarg+1] = argument + end + end + for i=1,-5,-1 do + newarg[i] = arg[i] + end + + environment.initializearguments(newarg) + + environment.originalarguments = mark(newarg) + environment.rawarguments = mark(arg) + + arg = { } -- prevent duplicate handling + +end diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 1b0334cc9..1d56ffd16 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 : 02/05/13 13:35:14 +-- merge date : 02/05/13 22:32:22 do -- begin closure to overcome local limits and interference |