summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-02-09 15:15:46 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2014-02-09 15:15:46 +0100
commite069690a7f747f7b17baed6974168192857eb485 (patch)
tree5705351f4ebbc439fbb04d17a4942ba85db3ebbc
parent405ff5a3f24566f76a3d08d7ba217a137fcb5bdd (diff)
downloadluaotfload-e069690a7f747f7b17baed6974168192857eb485.tar.gz
[log,*] move logs -> luaotfload.log
Next step toward https://github.com/lualatex/luaotfload/issues/169 Signed-off-by: Philipp Gesang <phg42.2a@gmail.com>
-rw-r--r--luaotfload-auxiliary.lua61
-rw-r--r--luaotfload-database.lua28
-rw-r--r--luaotfload-diagnostics.lua3
-rw-r--r--luaotfload-features.lua3
-rw-r--r--luaotfload-letterspace.lua11
-rw-r--r--luaotfload-log.lua34
-rw-r--r--luaotfload-main.lua60
-rw-r--r--luaotfload-override.lua4
-rw-r--r--luaotfload-parsers.lua4
-rwxr-xr-xluaotfload-tool.lua80
10 files changed, 157 insertions, 131 deletions
diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua
index 334ac47..9ab78e7 100644
--- a/luaotfload-auxiliary.lua
+++ b/luaotfload-auxiliary.lua
@@ -17,7 +17,7 @@ luaotfload.aux = luaotfload.aux or { }
local aux = luaotfload.aux
local log = luaotfload.log
-local warning = luaotfload.log
+local report = log.names_report
local fonthashes = fonts.hashes
local identifiers = fonthashes.identifiers
@@ -54,8 +54,8 @@ local start_rewrite_fontname = function ()
rewrite_fontname,
"luaotfload.rewrite_fontname")
rewriting = true
- logs.names_report ("log", 0, "aux",
- "start rewriting tfmdata.name field")
+ report ("log", 0, "aux",
+ "start rewriting tfmdata.name field")
end
end
@@ -66,8 +66,8 @@ local stop_rewrite_fontname = function ()
luatexbase.remove_fromt_callback
("luaotfload.patch_font", "luaotfload.rewrite_fontname")
rewriting = false
- logs.names_report ("log", 0, "aux",
- "stop rewriting tfmdata.name field")
+ report ("log", 0, "aux",
+ "stop rewriting tfmdata.name field")
end
end
@@ -366,7 +366,7 @@ do
local load_chardef = function ()
- log ("Loading character metadata from %s.", chardef)
+ report ("both", 1, "aux", "Loading character metadata from %s.", chardef)
chardata = dofile (kpse.find_file (chardef, "lua"))
if chardata == nil then
@@ -424,19 +424,19 @@ local provides_script = function (font_id, asked_script)
--- where method: "gpos" | "gsub"
for feature, data in next, featuredata do
if data[asked_script] then
- log(stringformat(
- "font no %d (%s) defines feature %s for script %s",
- font_id, fontname, feature, asked_script))
+ report ("log", 1, "aux",
+ "font no %d (%s) defines feature %s for script %s",
+ font_id, fontname, feature, asked_script)
return true
end
end
end
- log(stringformat(
- "font no %d (%s) defines no feature for script %s",
- font_id, fontname, asked_script))
+ report ("log", 0, "aux",
+ "font no %d (%s) defines no feature for script %s",
+ font_id, fontname, asked_script)
end
end
- log(stringformat("no font with id %d", font_id))
+ report ("log", 0, "aux", "no font with id %d", font_id)
return false
end
@@ -463,20 +463,22 @@ local provides_language = function (font_id, asked_script, asked_language)
for feature, data in next, featuredata do
local scriptdata = data[asked_script]
if scriptdata and scriptdata[asked_language] then
- log(stringformat("font no %d (%s) defines feature %s "
- .. "for script %s with language %s",
- font_id, fontname, feature,
- asked_script, asked_language))
+ report ("log", 1, "aux",
+ "font no %d (%s) defines feature %s "
+ .. "for script %s with language %s",
+ font_id, fontname, feature,
+ asked_script, asked_language)
return true
end
end
end
- log(stringformat(
- "font no %d (%s) defines no feature for script %s with language %s",
- font_id, fontname, asked_script, asked_language))
+ report ("log", 0, "aux",
+ "font no %d (%s) defines no feature "
+ .. "for script %s with language %s",
+ font_id, fontname, asked_script, asked_language)
end
end
- log(stringformat("no font with id %d", font_id))
+ report ("log", 0, "aux", "no font with id %d", font_id)
return false
end
@@ -534,20 +536,21 @@ local provides_feature = function (font_id, asked_script,
if feature then
local scriptdata = feature[asked_script]
if scriptdata and scriptdata[asked_language] then
- log(stringformat("font no %d (%s) defines feature %s "
- .. "for script %s with language %s",
- font_id, fontname, asked_feature,
- asked_script, asked_language))
+ report ("log", 1, "aux",
+ "font no %d (%s) defines feature %s "
+ .. "for script %s with language %s",
+ font_id, fontname, asked_feature,
+ asked_script, asked_language)
return true
end
end
end
- log(stringformat(
- "font no %d (%s) does not define feature %s for script %s with language %s",
- font_id, fontname, asked_feature, asked_script, asked_language))
+ report ("log", 0, "aux",
+ "font no %d (%s) does not define feature %s for script %s with language %s",
+ font_id, fontname, asked_feature, asked_script, asked_language)
end
end
- log(stringformat("no font with id %d", font_id))
+ report ("log", 0, "aux", "no font with id %d", font_id)
return false
end
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index d9bba80..8f603db 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -44,6 +44,13 @@ local read_fonts_conf = parsers.read_fonts_conf
local stripslashes = parsers.stripslashes
local splitcomma = parsers.splitcomma
+local log = luaotfload.log
+local report = log.names_report
+local report_status = log.names_status
+local report_status_start = log.names_status_start
+local report_status_stop = log.names_status_stop
+
+
--- Luatex builtins
local load = load
local next = next
@@ -151,11 +158,6 @@ local make_luanames = function (path)
filereplacesuffix(path, "luc")
end
-local report = logs.names_report
-local report_status = logs.names_status
-local report_status_start = logs.names_status_start
-local report_status_stop = logs.names_status_stop
-
--- The “termwidth” value is only considered when printing
--- short status messages, e.g. when building the database
--- online.
@@ -231,7 +233,11 @@ if not runasscript then
index.lua, index.luc = make_luanames (index_file)
else --- running as script, inject some dummies
caches = { }
- logs = { report = function () end }
+ local dummy_function = function () end
+ log = { report = dummy_function,
+ report_status = dummy_function,
+ report_status_start = dummy_function,
+ report_status_stop = dummy_function, }
end
@@ -2284,7 +2290,7 @@ local scan_texmf_fonts = function (currentnames, targetnames, dry_run)
report ("info", 1, "db", "Scanning TEXMF fonts...")
else
report ("info", 1, "db", "Scanning TEXMF and OS fonts...")
- if logs.get_loglevel () > 3 then
+ if log.get_loglevel () > 3 then
local osdirs = filesplitpath (osfontdir)
report ("info", 0, "db",
"$OSFONTDIR has %d entries:", #osdirs)
@@ -2979,7 +2985,7 @@ local collect_statistics = function (mappings)
local n_fullname = setsize (fullname)
local n_family = setsize (family)
- if logs.get_loglevel () > 1 then
+ if log.get_loglevel () > 1 then
local pprint_top = function (hash, n, set)
local freqs = { }
@@ -3165,7 +3171,7 @@ update_names = function (currentnames, force, dry_run)
if success then
local success = save_lookups ()
if success then
- logs.names_report ("info", 2, "cache",
+ report ("info", 2, "cache",
"Lookup cache emptied.")
return targetnames
end
@@ -3354,7 +3360,7 @@ end
local purge_cache = function ( )
local writable_path = getwritablecachepath ()
local luanames, lucnames, rest = collect_cache(writable_path)
- if logs.get_loglevel() > 1 then
+ if log.get_loglevel() > 1 then
print_cache("writable path", writable_path, luanames, lucnames, rest)
end
local success = purge_from_cache("writable path", writable_path, luanames, false)
@@ -3365,7 +3371,7 @@ end
local erase_cache = function ( )
local writable_path = getwritablecachepath ()
local luanames, lucnames, rest, all = collect_cache(writable_path)
- if logs.get_loglevel() > 1 then
+ if log.get_loglevel() > 1 then
print_cache("writable path", writable_path, luanames, lucnames, rest)
end
local success = purge_from_cache("writable path", writable_path, all, true)
diff --git a/luaotfload-diagnostics.lua b/luaotfload-diagnostics.lua
index 1ae9a90..4ffaa06 100644
--- a/luaotfload-diagnostics.lua
+++ b/luaotfload-diagnostics.lua
@@ -49,8 +49,9 @@ local lpeg = require "lpeg"
local C, Cg, Ct = lpeg.C, lpeg.Cg, lpeg.Ct
local lpegmatch = lpeg.match
+local names_report = luaotfload.log.names_report
local out = function (...)
- logs.names_report (false, 0, "diagnose", ...)
+ names_report (false, 0, "diagnose", ...)
end
local parsers = luaotfload.parsers
diff --git a/luaotfload-features.lua b/luaotfload-features.lua
index 5172f4b..73edcd2 100644
--- a/luaotfload-features.lua
+++ b/luaotfload-features.lua
@@ -48,7 +48,8 @@ function fonts.definers.getspecification(str)
return "", str, "", ":", str
end
-local report = logs.names_report
+local log = luaotfload.log
+local report = log.names_report
local stringfind = string.find
local stringlower = string.lower
diff --git a/luaotfload-letterspace.lua b/luaotfload-letterspace.lua
index 1957f9a..a855bf3 100644
--- a/luaotfload-letterspace.lua
+++ b/luaotfload-letterspace.lua
@@ -6,6 +6,9 @@ if not modules then modules = { } end modules ['letterspace'] = {
license = "see context related readme files"
}
+local log = luaotfload.log
+local report = log.names_report
+
local getmetatable = getmetatable
local require = require
local setmetatable = setmetatable
@@ -512,10 +515,10 @@ otffeatures.register {
local initializecompatfontkerning = function (tfmdata, percentage)
local factor = tonumber (percentage)
if not factor then
- logs.names_report ("both", 0, "letterspace",
- "Invalid argument to letterspace: %s (type %q), " ..
- "was expecting percentage as Lua number instead.",
- percentage, type (percentage))
+ names_report ("both", 0, "letterspace",
+ "Invalid argument to letterspace: %s (type %q), " ..
+ "was expecting percentage as Lua number instead.",
+ percentage, type (percentage))
return
end
return initializefontkerning (tfmdata, factor * 0.01)
diff --git a/luaotfload-log.lua b/luaotfload-log.lua
index d057eb3..080550a 100644
--- a/luaotfload-log.lua
+++ b/luaotfload-log.lua
@@ -15,6 +15,10 @@ because we lack a user interface to toggle per-subsystem tracing.
local module_name = "luaotfload" --- prefix for messages
+luaotfload = luaotfload or { }
+luaotfload.log = luaotfload.log or { }
+local log = luaotfload.log
+
local ioopen = io.open
local iowrite = io.write
local lfsisdir = lfs.isdir
@@ -48,17 +52,13 @@ local set_loglevel = function (n)
end
return true
end
-logs.setloglevel = set_loglevel
-logs.set_loglevel = set_loglevel
-logs.set_log_level = set_loglevel --- accomodating lazy typists
+log.set_loglevel = set_loglevel
--- unit -> int
local get_loglevel = function ( )
return loglevel
end
-logs.getloglevel = get_loglevel
-logs.get_loglevel = get_loglevel
-logs.get_log_level = get_loglevel
+log.get_loglevel = get_loglevel
local writeln --- pointer to terminal/log writer
local statusln --- terminal writer that reuses the current line
@@ -128,9 +128,9 @@ local set_logout = function (s, finalizers)
return finalizers
end
-logs.set_logout = set_logout
+log.set_logout = set_logout
-local log = function (category, fmt, ...)
+local basic_logger = function (category, fmt, ...)
local res = { module_name, "|", category, ":" }
if fmt then
res [#res + 1] = stringformat (fmt, ...)
@@ -219,7 +219,7 @@ local level_ids = { common = 1, loading = 2, search = 3 }
over. (This is a little sub-optimal performance-wise since the
function calls to the logger are executed regardless.) The log
level during a Luatex run can be adjusted by setting the “loglevel”
- field in config.luaotfload, or by calling logs.set_loglevel() as
+ field in config.luaotfload, or by calling log.set_loglevel() as
defined above.
--doc]]--
@@ -232,9 +232,9 @@ local names_report = function (mode, lvl, ...)
if loglevel >= lvl then
if mode == "log" then
- log (...)
+ basic_logger (...)
elseif mode == "both" and logout ~= "redirect" then
- log (...)
+ basic_logger (...)
stdout (writeln, ...)
else
stdout (writeln, ...)
@@ -242,7 +242,7 @@ local names_report = function (mode, lvl, ...)
end
end
-logs.names_report = names_report
+log.names_report = names_report
--[[doc--
@@ -266,10 +266,10 @@ logs.names_report = names_report
local status_logger = function (mode, ...)
if mode == "log" then
- log (...)
+ basic_logger (...)
else
if mode == "both" and logout ~= "redirect" then
- log (...)
+ basic_logger (...)
stdout (statusln, ...)
else
stdout (statusln, ...)
@@ -331,9 +331,9 @@ local status_stop = function (...)
end
end
-logs.names_status = function (...) status_writer (...) end
-logs.names_status_start = status_start
-logs.names_status_stop = status_stop
+log.names_status = function (...) status_writer (...) end
+log.names_status_start = status_start
+log.names_status_stop = status_stop
--[[doc--
diff --git a/luaotfload-main.lua b/luaotfload-main.lua
index 3f356ed..35c01f2 100644
--- a/luaotfload-main.lua
+++ b/luaotfload-main.lua
@@ -4,7 +4,7 @@
-- REQUIREMENTS: luatex v.0.78 or later, the lualibs package
-- AUTHOR: Élie Roux, Khaled Hosny, Philipp Gesang
-- VERSION: same as Luaotfload
--- MODIFIED: 2014-01-16 06:51:20+0100
+-- MODIFIED: 2014-02-09 14:42:22+0100
-----------------------------------------------------------------------
--
--- Note:
@@ -45,6 +45,7 @@ if not modules then modules = { } end modules ["luaotfload-main"] = {
luaotfload = luaotfload or { }
local luaotfload = luaotfload
+luaotfload.log = luaotfload.log or { }
config = config or { }
config.luaotfload = config.luaotfload or { }
@@ -91,10 +92,12 @@ local dummy_function = function () end
local error, warning, info, log =
luatexbase.provides_module(luaotfload.module)
-luaotfload.error = error
-luaotfload.warning = warning
-luaotfload.info = info
-luaotfload.log = log
+luaotfload.log.tex = {
+ error = error,
+ warning = warning,
+ info = info,
+ log = log,
+}
--[[doc--
@@ -143,6 +146,12 @@ local loadmodule = function (name)
require(fl_prefix .."-"..name)
end
+loadmodule "log.lua" --- messages; used to be part of -override
+local log = luaotfload.log
+local report = log.names_report
+
+log.set_loglevel(config.luaotfload.loglevel)
+
--[[doc--
Before \TeX Live 2013 version, \LUATEX had a bug that made ofm fonts
@@ -167,7 +176,8 @@ local find_vf_file = function (name)
fullname = kpsefind_file(lpegmatch(p_removesuffix, name), "ovf")
end
if fullname then
- log("loading virtual font file %s.", fullname)
+ report ("log", 0, "main",
+ "loading virtual font file %s.", fullname)
end
return fullname
end
@@ -251,7 +261,7 @@ end
local context_environment = { }
local push_namespaces = function ()
- log("push namespace for font loader")
+ report ("log", 1, "main", "push namespace for font loader")
local normalglobal = { }
for k, v in next, _G do
normalglobal[k] = v
@@ -264,7 +274,7 @@ local pop_namespaces = function (normalglobal, isolate)
local _G = _G
local mode = "non-destructive"
if isolate then mode = "destructive" end
- log("pop namespace from font loader -- " .. mode)
+ report ("log", 1, "main", "pop namespace from font loader -- " .. mode)
for k, v in next, _G do
if not normalglobal[k] then
context_environment[k] = v
@@ -279,7 +289,8 @@ local pop_namespaces = function (normalglobal, isolate)
-- just to be sure:
setmetatable(context_environment,_G)
else
- log("irrecoverable error during pop_namespace: no globals to restore")
+ report ("both", 0, "main",
+ "irrecoverable error during pop_namespace: no globals to restore")
os.exit()
end
end
@@ -312,13 +323,13 @@ loadmodule "fontloader.lua"
if fonts then
if not fonts._merge_loaded_message_done_ then
- log [["I am using the merged fontloader here.]]
- log [[ If you run into problems or experience unexpected]]
- log [[ behaviour, and if you have ConTeXt installed you can try]]
- log [[ to delete the file 'luaotfload-fontloader.lua' as I might]]
- log [[ then use the possibly updated libraries. The merged]]
- log [[ version is not supported as it is a frozen instance.]]
- log [[ Problems can be reported to the ConTeXt mailing list."]]
+ report ("log", 0, "main", [["I am using the merged fontloader here.]])
+ report ("log", 0, "main", [[ If you run into problems or experience unexpected]])
+ report ("log", 0, "main", [[ behaviour, and if you have ConTeXt installed you can try]])
+ report ("log", 0, "main", [[ to delete the file 'luaotfload-fontloader.lua' as I might]])
+ report ("log", 0, "main", [[ then use the possibly updated libraries. The merged]])
+ report ("log", 0, "main", [[ version is not supported as it is a frozen instance.]])
+ report ("log", 0, "main", [[ Problems can be reported to the ConTeXt mailing list."]])
end
fonts._merge_loaded_message_done_ = true
@@ -376,7 +387,7 @@ end --- non-merge fallback scope
pop_namespaces(our_environment, false)-- true)
-log("fontloader loaded in %0.3f seconds", os.gettimeofday()-starttime)
+report ("both", 0, "main", "fontloader loaded in %0.3f seconds", os.gettimeofday()-starttime)
--[[doc--
@@ -409,11 +420,8 @@ add_to_callback("hpack_filter",
add_to_callback("find_vf_file",
find_vf_file, "luaotfload.find_vf_file")
-loadmodule "log.lua" --- messages; used to be part of -override
loadmodule "override.lua" --- load glyphlist on demand
-logs.set_loglevel(config.luaotfload.loglevel)
-
--[[doc--
Now we load the modules written for \identifier{luaotfload}.
@@ -535,9 +543,9 @@ request_resolvers.anon = function (specification)
local exists, _ = lfsisfile(name)
if exists then --- garbage; we do this because we are nice,
--- not because it is correct
- logs.names_report("log", 1, "load", "file %q exists", name)
- logs.names_report("log", 1, "load",
- "... overriding borked anon: lookup with path: lookup")
+ log.names_report("log", 1, "load", "file %q exists", name)
+ log.names_report("log", 1, "load",
+ "... overriding borked anon: lookup with path: lookup")
specification.name = name
request_resolvers.path(specification)
return
@@ -559,9 +567,9 @@ request_resolvers.path = function (specification)
local name = specification.name
local exists, _ = lfsisfile(name)
if not exists then -- resort to file: lookup
- logs.names_report("log", 1, "load",
- "path lookup of %q unsuccessful, falling back to file:",
- name)
+ log.names_report("log", 1, "load",
+ "path lookup of %q unsuccessful, falling back to file:",
+ name)
file_resolver (specification)
else
local suffix = filesuffix (name)
diff --git a/luaotfload-override.lua b/luaotfload-override.lua
index 4363b74..e726f6f 100644
--- a/luaotfload-override.lua
+++ b/luaotfload-override.lua
@@ -7,9 +7,11 @@ if not modules then modules = { } end modules ["luaotfload-override"] = {
}
local findfile = resolvers.findfile
-local names_report = logs.names_report
local encodings = fonts.encodings
+local log = luaotfload.log
+local names_report = log.names_report
+
--[[doc--
Adobe Glyph List.
diff --git a/luaotfload-parsers.lua b/luaotfload-parsers.lua
index 51d251c..8060d05 100644
--- a/luaotfload-parsers.lua
+++ b/luaotfload-parsers.lua
@@ -38,8 +38,8 @@ local filedirname = file.dirname
local io = io
local ioopen = io.open
-local logs = logs
-local report = logs.report
+local log = luaotfload.log
+local report = log.names_report
local string = string
local stringsub = string.sub
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua
index 6ca7d69..e791e3d 100755
--- a/luaotfload-tool.lua
+++ b/luaotfload-tool.lua
@@ -9,7 +9,10 @@
-- MODIFIED: 2014-01-14 13:17:04+0100
-----------------------------------------------------------------------
-local version = "2.5" --- <int: major>.<int: minor><alpha: fixes>
+luaotfload = luaotfload or { }
+local version = "2.5" --- <int: major>.<int: minor>-<int: fixes>
+luaotfload.version = version
+luaotfload.self = "luaotfload-tool"
--[[doc--
@@ -104,8 +107,6 @@ if not luaotfloadconfig.strip then
luaotfloadconfig.strip = true
end
-luaotfloadconfig.self = "luaotfload-tool"
-
config.lualibs = config.lualibs or { }
config.lualibs.verbose = false
config.lualibs.prefer_merged = true
@@ -141,23 +142,24 @@ require"luaotfload-basics-gen.lua"
texio.write, texio.write_nl = backup.write, backup.write_nl
utilities = backup.utilities
-require"luaotfload-log.lua" --- this populates the logs.* namespace
+require"luaotfload-log.lua" --- this populates the luaotfload.log.* namespace
require"luaotfload-parsers" --- fonts.conf and request syntax
require"luaotfload-database"
require"alt_getopt"
-local names = fonts.names
-
+local names = fonts.names
local status_file = "luaotfload-status"
local luaotfloadstatus = require (status_file)
luaotfloadconfig.status = luaotfloadstatus
-
local sanitize_fontname = names.sanitize_fontname
-local pathdata = names.path
-local names_plain = pathdata.index.lua
-local names_gzip = names_plain .. ".gz"
-local names_bin = pathdata.index.luc
+local log = luaotfload.log
+local names_report = log.names_report -- TODO improve identifier
+
+local pathdata = names.path
+local names_plain = pathdata.index.lua
+local names_gzip = names_plain .. ".gz"
+local names_bin = pathdata.index.luc
local help_messages = {
["luaotfload-tool"] = [[
@@ -248,7 +250,7 @@ Enter 'luaotfload-tool --help' for a larger list of options.
local help_msg = function (version)
local template = help_messages[version]
iowrite(stringformat(template,
- luaotfloadconfig.self,
+ luaotfload.self,
-- names_plain,
names_gzip,
names_bin,
@@ -265,8 +267,8 @@ local about = [[
local version_msg = function ( )
local out = function (...) texiowrite_nl (stringformat (...)) end
- out (about, luaotfloadconfig.self)
- out ("%s version %q", luaotfloadconfig.self, version)
+ out (about, luaotfload.self)
+ out ("%s version %q", luaotfload.self, version)
out ("revision %q", luaotfloadstatus.notes.revision)
out ("database version %q", names.version)
out ("Lua interpreter: %s; version %q", runtime[1], runtime[2])
@@ -681,7 +683,7 @@ local show_font_info = function (basename, askedname, detail, warnings)
if nfonts > 0 then -- true type collection
local subfont
if askedname then
- logs.names_report(true, 1, "resolve",
+ log.names_report(true, 1, "resolve",
[[%s is part of the font collection %s]],
askedname, basename)
subfont = subfont_by_name(shortinfo, askedname)
@@ -692,10 +694,10 @@ local show_font_info = function (basename, askedname, detail, warnings)
show_full_info(fullname, subfont, warnings)
end
else -- list all subfonts
- logs.names_report(true, 1, "resolve",
+ log.names_report(true, 1, "resolve",
[[%s is a font collection]], basename)
for subfont = 1, nfonts do
- logs.names_report(true, 1, "resolve",
+ log.names_report(true, 1, "resolve",
[[Showing info for font no. %d]], n)
show_info_items(shortinfo[subfont])
if detail == true then
@@ -710,7 +712,7 @@ local show_font_info = function (basename, askedname, detail, warnings)
end
end
else
- logs.names_report(true, 1, "resolve",
+ log.names_report(true, 1, "resolve",
"Font %s not found", filename)
end
end
@@ -735,10 +737,10 @@ action_pending.generate = false --- this is the default action
local actions = { } --- (jobspec -> (bool * bool)) list
actions.loglevel = function (job)
- logs.set_loglevel(job.log_level)
- logs.names_report("info", 3, "util",
+ log.set_loglevel(job.log_level)
+ log.names_report("info", 3, "util",
"Setting log level", "%d", job.log_level)
- logs.names_report("log", 2, "util", "Lua=%s", _VERSION)
+ log.names_report("log", 2, "util", "Lua=%s", _VERSION)
return true, true
end
@@ -764,7 +766,7 @@ end
actions.generate = function (job)
local fontnames, savedname
fontnames = names.update(fontnames, job.force_reload, job.dry_run)
- logs.names_report("info", 2, "db",
+ log.names_report("info", 2, "db",
"Fonts in the database: %i", #fontnames.mappings)
if names.data() then
return true, true
@@ -777,7 +779,7 @@ actions.flush = function (job)
if success then
local success = names.save_lookups()
if success then
- logs.names_report("info", 2, "cache", "Lookup cache emptied")
+ log.names_report("info", 2, "cache", "Lookup cache emptied")
return true, true
end
end
@@ -793,7 +795,7 @@ local cache_directives = {
actions.cache = function (job)
local directive = cache_directives[job.cache]
if not directive or type(directive) ~= "function" then
- logs.names_report("info", 2, "cache",
+ log.names_report("info", 2, "cache",
"Invalid font cache directive %s.", job.cache)
return false, false
end
@@ -838,14 +840,14 @@ actions.query = function (job)
end
if success then
- logs.names_report(false, 0,
+ log.names_report(false, 0,
"resolve", "Font %q found!", query)
if subfont then
- logs.names_report(false, 0, "resolve",
+ log.names_report(false, 0, "resolve",
"Resolved file name %q, subfont nr. %q",
foundname, subfont)
else
- logs.names_report(false, 0, "resolve",
+ log.names_report(false, 0, "resolve",
"Resolved file name %q", foundname)
end
if job.show_info then
@@ -853,12 +855,12 @@ actions.query = function (job)
iowrite "\n"
end
else
- logs.names_report(false, 0,
+ log.names_report(false, 0,
"resolve", "Cannot find %q in index.", query)
- logs.names_report(false, 0,
+ log.names_report(false, 0,
"resolve", "Hint: use the --fuzzy option to display suggestions.", query)
if job.fuzzy == true then
- logs.names_report(false, 0,
+ log.names_report(false, 0,
"resolve", "Looking for close matches, this may take a while ...")
local _success = names.find_closest(query, job.fuzzy_limit)
end
@@ -957,7 +959,7 @@ actions.list = function (job)
local nmappings = #mappings
if criterion == "*" then
- logs.names_report(false, 1, "list", "All %d entries", nmappings)
+ log.names_report(false, 1, "list", "All %d entries", nmappings)
for i=1, nmappings do
local entry = mappings[i]
local fields = get_fields(entry, asked_fields)
@@ -972,12 +974,12 @@ actions.list = function (job)
criterion = criterion[1]
asked_fields = set_primary_field(asked_fields, criterion)
- logs.names_report(false, 1, "list", "By %s", criterion)
+ log.names_report(false, 1, "list", "By %s", criterion)
--- firstly, build a list of fonts to operate on
local targets = { }
if asked_value then --- only those whose value matches
- logs.names_report(false, 2, "list", "Restricting to value %s", asked_value)
+ log.names_report(false, 2, "list", "Restricting to value %s", asked_value)
for i=1, nmappings do
local entry = mappings[i]
if entry[criterion]
@@ -1022,7 +1024,7 @@ actions.list = function (job)
end
end
local ntargets = #targets
- logs.names_report(false, 2, "list", "%d entries", ntargets)
+ log.names_report(false, 2, "list", "%d entries", ntargets)
--- now, output the collection
for i=1, ntargets do
@@ -1150,7 +1152,7 @@ local process_cmdline = function ( ) -- unit -> jobspec
elseif v == "log" then
local str = optarg[n]
if str then
- finalizers = logs.set_logout(str, finalizers)
+ finalizers = log.set_logout(str, finalizers)
end
elseif v == "find" then
action_pending["query"] = true
@@ -1230,23 +1232,23 @@ local main = function ( ) -- unit -> int
local actionname = action_sequence[i]
local exit = false
if action_pending[actionname] then
- logs.names_report("log", 3, "util", "Preparing for task",
+ log.names_report("log", 3, "util", "Preparing for task",
"%s", actionname)
local action = actions[actionname]
local success, continue = action(job)
if not success then
- logs.names_report(false, 0, "util",
+ log.names_report(false, 0, "util",
"Could not finish task", "%s", actionname)
retval = -1
exit = true
elseif not continue then
- logs.names_report(false, 3, "util",
+ log.names_report(false, 3, "util",
"Task completed, exiting", "%s", actionname)
exit = true
else
- logs.names_report(false, 3, "util",
+ log.names_report(false, 3, "util",
"Task completed successfully", "%s", actionname)
end
end