From 04b23cb87054eddbf5ca32635848480f69bae502 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 6 May 2014 10:06:00 +0200 Subject: beta 2014.05.06 10:06 --- tex/context/base/cont-new.mkiv | 2 +- tex/context/base/context-version.pdf | Bin 4056 -> 4065 bytes tex/context/base/context.mkiv | 2 +- tex/context/base/meta-ini.mkiv | 1 + tex/context/base/mlib-lua.lua | 77 ++++++++++++++------- tex/context/base/mult-def.mkiv | 1 + tex/context/base/status-files.pdf | Bin 24657 -> 24652 bytes tex/context/base/status-lua.pdf | Bin 242871 -> 242873 bytes tex/context/base/type-imp-texgyre.mkiv | 2 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 10 files changed, 58 insertions(+), 29 deletions(-) diff --git a/tex/context/base/cont-new.mkiv b/tex/context/base/cont-new.mkiv index cf9aa9a87..3e525f0d5 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{2014.05.05 22:31} +\newcontextversion{2014.05.06 10:06} %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 b544f56fe..ecd9899ad 100644 Binary files a/tex/context/base/context-version.pdf and b/tex/context/base/context-version.pdf differ diff --git a/tex/context/base/context.mkiv b/tex/context/base/context.mkiv index 9ef439e45..9856e620e 100644 --- a/tex/context/base/context.mkiv +++ b/tex/context/base/context.mkiv @@ -28,7 +28,7 @@ %D up and the dependencies are more consistent. \edef\contextformat {\jobname} -\edef\contextversion{2014.05.05 22:31} +\edef\contextversion{2014.05.06 10:06} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/meta-ini.mkiv b/tex/context/base/meta-ini.mkiv index 281143e40..555deca2c 100644 --- a/tex/context/base/meta-ini.mkiv +++ b/tex/context/base/meta-ini.mkiv @@ -220,6 +220,7 @@ \defineMPinstance[metafun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes] \defineMPinstance[extrafun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes] \defineMPinstance[doublefun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!double] +\defineMPinstance[binaryfun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!binary] \defineMPinstance[decimalfun][\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes,\c!method=\s!decimal] \defineMPinstance[mprun] [\s!format=metafun,\s!extensions=\v!yes,\s!initializations=\v!yes] \defineMPinstance[metapost] [\s!format=mpost] diff --git a/tex/context/base/mlib-lua.lua b/tex/context/base/mlib-lua.lua index 9c7a2e43a..e3a3ba5d8 100644 --- a/tex/context/base/mlib-lua.lua +++ b/tex/context/base/mlib-lua.lua @@ -8,6 +8,8 @@ if not modules then modules = { } end modules ['mlib-pdf'] = { -- This is very preliminary code! +-- maybe we need mplib.model, but how with instances + local type, tostring, select, loadstring = type, tostring, select, loadstring local formatters = string.formatters local find, gsub = string.find, string.gsub @@ -51,14 +53,25 @@ function mp._f_() end end -local f_pair = formatters["(%s,%s)"] -local f_triplet = formatters["(%s,%s,%s)"] -local f_quadruple = formatters["(%s,%s,%s,%s)"] +local f_numeric = formatters["%.16f"] +local f_pair = formatters["(%.16f,%.16f)"] +local f_triplet = formatters["(%.16f,%.16f,%.16f)"] +local f_quadruple = formatters["(%.16f,%.16f,%.16f,%.16f)"] function mp.print(...) for i=1,select("#",...) do - n = n + 1 - buffer[n] = tostring((select(i,...))) + local value = select(i,...) + if value then + n = n + 1 + local t = type(value) + if t == "number" then + buffer[n] = f_numeric(value) + elseif t == "string" then + buffer[n] = value + else + buffer[n] = tostring(value) + end + end end end @@ -113,14 +126,23 @@ end local f_code = formatters["%s return mp._f_()"] -function metapost.runscript(code) - local f = loadstring(f_code(code)) - if f then - return tostring(f()) - else - return "" - end -end +-- function metapost.runscript(code) +-- local f = loadstring(f_code(code)) +-- if f then +-- local result = f() +-- if result then +-- local t = type(result) +-- if t == "number" then +-- return f_numeric(result) +-- elseif t == "string" then +-- return result +-- else +-- return tostring(result) +-- end +-- end +-- end +-- return "" +-- end local cache, n = { }, 0 -- todo: when > n then reset cache or make weak @@ -128,29 +150,34 @@ function metapost.runscript(code) if trace_enabled and trace_luarun then report_luarun("code: %s",code) end + local f if n > 100 then cache = nil -- forget about caching - local f = loadstring(f_code(code)) - if f then - return tostring(f()) - else - return "" - end + f = loadstring(f_code(code)) else - local f = cache[code] - if f then - return tostring(f()) - else + f = cache[code] + if not f then f = loadstring(f_code(code)) if f then n = n + 1 cache[code] = f - return tostring(f()) + end + end + end + if f then + local result = f() + if result then + local t = type(result) + if t == "number" then + return f_numeric(result) + elseif t == "string" then + return result else - return "" + return tostring(result) end end end + return "" end -- function metapost.initializescriptrunner(mpx) diff --git a/tex/context/base/mult-def.mkiv b/tex/context/base/mult-def.mkiv index 35b212710..f6548c75b 100644 --- a/tex/context/base/mult-def.mkiv +++ b/tex/context/base/mult-def.mkiv @@ -97,6 +97,7 @@ \def\s!double {double} \def\s!decimal {decimal} +\def\s!binary {binary} \def\s!current {current} diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf index a4381c06d..431eaa2ab 100644 Binary files a/tex/context/base/status-files.pdf and b/tex/context/base/status-files.pdf differ diff --git a/tex/context/base/status-lua.pdf b/tex/context/base/status-lua.pdf index ad8475aed..d19e15513 100644 Binary files a/tex/context/base/status-lua.pdf and b/tex/context/base/status-lua.pdf differ diff --git a/tex/context/base/type-imp-texgyre.mkiv b/tex/context/base/type-imp-texgyre.mkiv index b2aaa3629..2484066cc 100644 --- a/tex/context/base/type-imp-texgyre.mkiv +++ b/tex/context/base/type-imp-texgyre.mkiv @@ -262,7 +262,7 @@ \starttypescript [\s!math][palatino,pagella][\s!all] \loadfontgoodies[texgyre] - \definefontsynonym[\s!MathRoman][file:texgyre-pagella-math-regular.otf][\s!features=\s!math\mathsizesuffix] + \definefontsynonym[\s!MathRoman][file:texgyre-pagella-math-regular.otf][goodies=texgyre-math,\s!features=\s!math\mathsizesuffix] \stoptypescript \stoptypescriptcollection diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 60083ae2f..511198a58 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 : 05/05/14 22:31:19 +-- merge date : 05/06/14 10:06:39 do -- begin closure to overcome local limits and interference -- cgit v1.2.3