diff options
author | Elie Roux <elie.roux@telecom-bretagne.eu> | 2009-04-23 15:22:25 +0200 |
---|---|---|
committer | Elie Roux <elie.roux@telecom-bretagne.eu> | 2009-04-23 15:22:25 +0200 |
commit | 190afdecb3f4d133e472fd17a140c57100219b7b (patch) | |
tree | c4dce7c6e609147c6709581bf52f6443b10b95ad /otfl-luat-con.lua | |
parent | fed311d67f0258a26530e04c43acf3d0261a25ce (diff) | |
download | luaotfload-190afdecb3f4d133e472fd17a140c57100219b7b.tar.gz |
sync with the latest ConTeXt beta, and using luaotfload in DVI mode too (for dvipdfmx)
Diffstat (limited to 'otfl-luat-con.lua')
-rw-r--r-- | otfl-luat-con.lua | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/otfl-luat-con.lua b/otfl-luat-con.lua deleted file mode 100644 index e93e920..0000000 --- a/otfl-luat-con.lua +++ /dev/null @@ -1,118 +0,0 @@ -if not modules then modules = { } end modules ['luat-loc'] = { - version = 1.001, - comment = "companion to luat-lib.tex", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local format, lower, gsub = string.format, string.lower, string.gsub - -local trace_cache = false trackers.register("input.cache", function(v) trace_cache = v end) -local trace_containers = false trackers.register("input.containers", function(v) trace_containers = v end) -local trace_storage = false trackers.register("input.storage", function(v) trace_storage = v end) -local trace_verbose = false trackers.register("input.verbose", function(v) trace_verbose = v end) -local trace_locating = false trackers.register("input.locating", function(v) trace_locating = v trace_verbose = v end) - ---[[ldx-- -<p>Once we found ourselves defining similar cache constructs -several times, containers were introduced. Containers are used -to collect tables in memory and reuse them when possible based -on (unique) hashes (to be provided by the calling function).</p> - -<p>Caching to disk is disabled by default. Version numbers are -stored in the saved table which makes it possible to change the -table structures without bothering about the disk cache.</p> - -<p>Examples of usage can be found in the font related code.</p> ---ldx]]-- - -containers = containers or { } - -containers.usecache = true - -local function report(container,tag,name) - if trace_cache or trace_containers then - logs.report(format("%s cache",container.subcategory),"%s: %s",tag,name or 'invalid') - end -end - -local allocated = { } - --- tracing - -function containers.define(category, subcategory, version, enabled) - return function() - if category and subcategory then - local c = allocated[category] - if not c then - c = { } - allocated[category] = c - end - local s = c[subcategory] - if not s then - s = { - category = category, - subcategory = subcategory, - storage = { }, - enabled = enabled, - version = version or 1.000, - trace = false, - path = caches and caches.setpath(category,subcategory), - } - c[subcategory] = s - end - return s - else - return nil - end - end -end - -function containers.is_usable(container, name) - return container.enabled and caches and caches.is_writable(container.path, name) -end - -function containers.is_valid(container, name) - if name and name ~= "" then - local storage = container.storage[name] - return storage and not table.is_empty(storage) and storage.cache_version == container.version - else - return false - end -end - -function containers.read(container,name) - if container.enabled and caches and not container.storage[name] and containers.usecache then - container.storage[name] = caches.loaddata(container.path,name) - if containers.is_valid(container,name) then - report(container,"loaded",name) - else - container.storage[name] = nil - end - end - if container.storage[name] then - report(container,"reusing",name) - end - return container.storage[name] -end - -function containers.write(container, name, data) - if data then - data.cache_version = container.version - if container.enabled and caches then - local unique, shared = data.unique, data.shared - data.unique, data.shared = nil, nil - caches.savedata(container.path, name, data) - report(container,"saved",name) - data.unique, data.shared = unique, shared - end - report(container,"stored",name) - container.storage[name] = data - end - return data -end - -function containers.content(container,name) - return container.storage[name] -end |