From b6878880e33627b3a05adfb11aded148aa3bd5b0 Mon Sep 17 00:00:00 2001 From: Elie Roux Date: Mon, 10 May 2010 11:34:16 +0300 Subject: Adaptation to luatexbase (just small changes) and removing functions that are now in luaextra. --- luaotfload.dtx | 88 +++++-------------------------------------------------- otfl-luat-ovr.lua | 2 +- 2 files changed, 8 insertions(+), 82 deletions(-) diff --git a/luaotfload.dtx b/luaotfload.dtx index d2cb55f..7dffafd 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -318,7 +318,7 @@ and the derived files % First some usual initializations. % % \begin{macrocode} -luaotfload = { } +module('luaotfload', package.seeall) luaotfload.module = { name = "luaotfload", @@ -330,7 +330,7 @@ luaotfload.module = { license = "CC0" } -luatextra.provides_module(luaotfload.module) +luatexbase.provides_module(luaotfload.module) % \end{macrocode} % @@ -341,7 +341,7 @@ luatextra.provides_module(luaotfload.module) local luatex_version = 60 if tex.luatexversion < luatex_version then - luatextra.module_warning('luaotfload', + luatexbase.module_warning('luaotfload', string.format('LuaTeX v%.2f is old, v%.2f is recommended.', tex.luatexversion/100, luatex_version /100)) @@ -359,87 +359,13 @@ function luaotfload.loadmodule(name) local tofind = 'otfl-'..name local found = kpse.find_file(tofind,"tex") if not found then - luatextra.module_error('luaotfload', string.format('file %s not found.', tofind)) + luatexbase.module_error('luaotfload', string.format('file %s not found.', tofind)) return end - luatextra.module_log('luaotfload', "loading file "..found) + luatexbase.module_log('luaotfload', "loading file "..found) dofile(found) end -% \end{macrocode} -% -% The following functions are made to map \ConTeXt\ functions to -% \textsf{luaextra} functions. -% -% \begin{macrocode} - -string.strip = string.stripspaces - -file = fpath -file.extname = fpath.suffix - -% \end{macrocode} -% -% These are small functions that are not already in \textsf{luatextra}. -% -% \begin{macrocode} - -local splitters_s, splitters_m = { }, { } - -function lpeg.splitat(separator,single) - local splitter = (single and splitters_s[separator]) or splitters_m[separator] - if not splitter then - separator = lpeg.P(separator) - if single then - local other, any = lpeg.C((1 - separator)^0), lpeg.P(1) - splitter = other * (separator * lpeg.C(any^0) + "") - splitters_s[separator] = splitter - else - local other = lpeg.C((1 - separator)^0) - splitter = other * (separator * other)^0 - splitters_m[separator] = splitter - end - end - return splitter -end - -function table.compact(t) - if t then - for k,v in next, t do - if not next(v) then - t[k] = nil - end - end - end -end - -function table.sortedhashkeys(tab) -- fast one - local srt = { } - for key,_ in next, tab do - srt[#srt+1] = key - end - table.sort(srt) - return srt -end - -function table.reverse_hash(h) - local r = { } - for k,v in next, h do - r[v] = string.lower(string.gsub(k," ","")) - end - return r -end - -function table.reverse(t) - local tt = { } - if #t > 0 then - for i=#t,1,-1 do - tt[#tt+1] = t[i] - end - end - return tt -end - % \end{macrocode} % % We start loading some lua files. These two are some code not used by @@ -473,9 +399,9 @@ luaotfload.loadmodule('node-ini.lua') % \begin{macrocode} function attributes.private(name) - local number = tex.attributenumber['otfl@'..name] + local number = luatexbase.attributes['otfl@'..name] if not number then - luatextra.module_error('luaotfload', string.format('asking for attribute %s, but not declared. Please report to the maintainer of luaotfload.', name)) + luatexbase.module_error('luaotfload', string.format('asking for attribute %s, but not declared. Please report to the maintainer of luaotfload.', name)) end return number end diff --git a/otfl-luat-ovr.lua b/otfl-luat-ovr.lua index 3670df7..af5e05b 100644 --- a/otfl-luat-ovr.lua +++ b/otfl-luat-ovr.lua @@ -32,4 +32,4 @@ function logs.simple(fmt,...) end end -tex.ctxcatcodes = luatextra.catcodetables.latex +tex.ctxcatcodes = luatexbase.catcodetables.latex -- cgit v1.2.3