From 85b7bc695629926641c7cb752fd478adfdf374f3 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 4 Jul 2010 15:32:09 +0300 Subject: stable 2010-05-24 13:10 --- tex/context/base/grph-fil.lua | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tex/context/base/grph-fil.lua (limited to 'tex/context/base/grph-fil.lua') diff --git a/tex/context/base/grph-fil.lua b/tex/context/base/grph-fil.lua new file mode 100644 index 000000000..2e32c7a60 --- /dev/null +++ b/tex/context/base/grph-fil.lua @@ -0,0 +1,42 @@ +if not modules then modules = { } end modules ['grph-fil'] = { + version = 1.001, + comment = "companion to grph-fig.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local format, concat = string.format, table.concat + +local trace_run = false trackers.register("files.run",function(v) trace_run = v end) + +local command = "context %s" + +jobfiles = jobfiles or { } +jobfiles.collected = jobfiles.collected or { } +jobfiles.tobesaved = jobfiles.tobesaved or { } + +local tobesaved, collected = jobfiles.tobesaved, jobfiles.collected + +local function initializer() + tobesaved, collected = jobfiles.tobesaved, jobfiles.collected +end + +job.register('jobfiles.collected', jobfiles.tobesaved, initializer) + +jobfiles.forcerun = false + +function jobfiles.run(name,...) + local oldchecksum = collected[name] + local newchecksum = file.checksum(name) + if jobfiles.forcerun or not oldchecksum or oldchecksum ~= newchecksum then + if trace_run then + commands.writestatus("buffers","changes in '%s', processing forced",name) + end + os.execute(format(command,concat({ name, ... }," "))) + elseif trace_run then + commands.writestatus("buffers","no changes in '%s', not processed",name) + end + tobesaved[name] = newchecksum + return file.replacesuffix(name,"pdf") +end -- cgit v1.2.3