summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luamplib
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-10-03 14:54:44 +0000
committerKarl Berry <karl@freefriends.org>2009-10-03 14:54:44 +0000
commitfe341a1ce588bf3b07c6489abb26db11ae8d7683 (patch)
treebff247ee9f91e608010ee9297fadf3caaf788df5 /Master/texmf-dist/tex/luatex/luamplib
parent32d264525281c96ddbb4fa19859eeed042c9dbfd (diff)
luamplib 1.02 (1oct09)
git-svn-id: svn://tug.org/texlive/trunk@15599 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luamplib')
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.lua45
-rw-r--r--Master/texmf-dist/tex/luatex/luamplib/luamplib.sty2
2 files changed, 30 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
index f48ce0a5314..1ceb41ff8bb 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.lua
@@ -23,9 +23,9 @@ luamplib = { }
luamplib.module = {
name = "luamplib",
- version = 1.01,
- date = "2009/09/23",
- description = "Lua functions to typeset Metapost directly with MPLib.",
+ version = 1.02,
+ date = "2009/10/01",
+ description = "Lua package to typeset Metapost with LuaTeX's MPLib.",
author = "Hans Hagen, Taco Hoekwater & Elie Roux",
copyright = "ConTeXt Development Team & Elie Roux",
license = "CC0",
@@ -38,7 +38,7 @@ local format, concat, abs = string.format, table.concat, math.abs
luamplib.currentformat = "plain"
-luamplib.currentmem = "luatex-plain.mem"
+luamplib.currentmem = "mpost"
local currentformat = luamplib.currentformat
local currentmem = luamplib.currentmem
@@ -52,18 +52,15 @@ function luamplib.setmemfile(name)
end
-luamplib.finder = luamplib.finder or function(name, mode, ftype)
+local mpkpse = kpse.new("luatex","mpost")
+
+function luamplib.finder(name, mode, ftype)
if mode == "w" then
return name
else
- local result
- if ftype == 'mem' then
- local envsave = os.getenv('engine')
- os.setenv('engine', 'metapost')
- result = kpse.find_file(name,ftype)
- os.setenv('engine', envsave)
- else
- result = kpse.find_file(name,ftype)
+ local result = mpkpse:find_file(name,ftype)
+ if not result and ftype == "mem" then
+ result = mpkpse:find_file("metapost/"..name,ftype)
end
return result
end
@@ -106,6 +103,17 @@ function luamplib.processlines()
end
+function luamplib.input_mp(name)
+ local mpx = mplib.new {
+ ini_version = true,
+ find_file = luamplib.finder,
+ job_name = name,
+ }
+ mpx:execute(format("input %s ;",name))
+ return mpx
+end
+
+
function luamplib.load()
local mpx = mplib.new {
ini_version = false,
@@ -114,10 +122,15 @@ function luamplib.load()
}
if mpx then
luamplib.log("using mem file %s", luamplib.finder(currentmem, 'r', 'mem'))
- return mpx, nil
else
- return nil, { status = 99, error = "out of memory or invalid format" }
+ mpx = luamplib.input_mp(currentformat)
+ if mpx then
+ luamplib.log("using mp file %s", luamplib.finder(currentformat, 'r', 'mp'))
+ else
+ luamplib.error("unable to load the metapost format.")
+ end
end
+ return mpx
end
@@ -294,7 +307,7 @@ function luamplib.flush(result,flusher)
local figures = result.fig
if figures then
for f=1, #figures do
- luamplib.info("flushing figure %s",f)
+ luamplib.log("flushing figure %s",f)
local figure = figures[f]
local objects = getobjects(result,figure,f)
local fignum = tonumber((figure:filename()):match("([%d]+)$") or figure:charcode() or 0)
diff --git a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
index 8d6209efa70..832546af69f 100644
--- a/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
+++ b/Master/texmf-dist/tex/luatex/luamplib/luamplib.sty
@@ -24,7 +24,7 @@
\else
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{luamplib}
- [2009/09/23 v1.01 mplib package for LuaTeX.]
+ [2009/10/01 v1.02 mplib package for LuaTeX.]
\RequirePackage{luatextra}
\RequirePackage{fancyvrb}
\fi