| 1 |
-- |
| 2 |
-- This is file `lualibs.lua', |
| 3 |
-- generated with the docstrip utility. |
| 4 |
-- |
| 5 |
-- The original source files were: |
| 6 |
-- |
| 7 |
-- lualibs.dtx (with options: `lualibs') |
| 8 |
-- This is a generated file. |
| 9 |
-- |
| 10 |
-- Copyright (C) 2009--2021 by |
| 11 |
-- PRAGMA ADE / ConTeXt Development Team |
| 12 |
-- The LaTeX Project Team |
| 13 |
-- |
| 14 |
-- See ConTeXt's mreadme.pdf for the license. |
| 15 |
-- |
| 16 |
-- This work consists of the main source file lualibs.dtx |
| 17 |
-- and the derived files lualibs.lua, lualibs-basic.lua, |
| 18 |
-- and lualibs-extended.lua. |
| 19 |
-- |
| 20 |
-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 21 |
-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 22 |
-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 23 |
-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 24 |
lualibs = lualibs or { } |
| 25 |
|
| 26 |
lualibs.module_info = { |
| 27 |
name = "lualibs", |
| 28 |
version = "2.76", --TAGVERSION |
| 29 |
date = "2023-07-13", --TAGDATE |
| 30 |
description = "ConTeXt Lua standard libraries.", |
| 31 |
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang", |
| 32 |
copyright = "PRAGMA ADE / ConTeXt Development Team", |
| 33 |
license = "See ConTeXt's mreadme.pdf for the license", |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
config = config or { } |
| 38 |
config.lualibs = config.lualibs or { } |
| 39 |
|
| 40 |
if config.lualibs.prefer_merged ~= nil then |
| 41 |
lualibs.prefer_merged = config.lualibs.prefer_merged |
| 42 |
else |
| 43 |
lualibs.prefer_merged = true |
| 44 |
end |
| 45 |
|
| 46 |
if config.lualibs.load_extended ~= nil then |
| 47 |
lualibs.load_extended = config.lualibs.load_extended |
| 48 |
else |
| 49 |
lualibs.load_extended = true |
| 50 |
end |
| 51 |
|
| 52 |
if config.lualibs.verbose ~= nil then |
| 53 |
config.lualibs.verbose = config.lualibs.verbose |
| 54 |
else |
| 55 |
config.lualibs.verbose = false |
| 56 |
end |
| 57 |
|
| 58 |
|
| 59 |
local dofile = dofile |
| 60 |
local kpsefind_file = kpse.find_file |
| 61 |
local stringformat = string.format |
| 62 |
local texiowrite_nl = texio.write_nl |
| 63 |
|
| 64 |
local find_file, error, warn, info |
| 65 |
do |
| 66 |
local _error, _warn, _info |
| 67 |
if luatexbase and luatexbase.provides_module then |
| 68 |
_error, _warn, _info = luatexbase.provides_module(lualibs.module_info) |
| 69 |
else |
| 70 |
_error, _warn, _info = texiowrite_nl, texiowrite_nl, texiowrite_nl |
| 71 |
end |
| 72 |
|
| 73 |
if lualibs.verbose then |
| 74 |
error, warn, info = _error, _warn, _info |
| 75 |
else |
| 76 |
local dummylogger = function ( ) end |
| 77 |
error, warn, info = _error, dummylogger, dummylogger |
| 78 |
end |
| 79 |
lualibs.error, lualibs.warn, lualibs.info = error, warn, info |
| 80 |
end |
| 81 |
|
| 82 |
if status.kpse_used == 0 then |
| 83 |
kpse.set_program_name("luatex") |
| 84 |
end |
| 85 |
|
| 86 |
find_file = kpsefind_file |
| 87 |
|
| 88 |
|
| 89 |
local loadmodule = loadmodule or function (name, t) |
| 90 |
if not t then t = "library" end |
| 91 |
local filepath = find_file(name, "lua") |
| 92 |
if not filepath or filepath == "" then |
| 93 |
warn(stringformat("Could not locate %s ā%sā.", t, name)) |
| 94 |
return false |
| 95 |
end |
| 96 |
dofile(filepath) |
| 97 |
return true |
| 98 |
end |
| 99 |
|
| 100 |
lualibs.loadmodule = loadmodule |
| 101 |
|
| 102 |
|
| 103 |
if lualibs.basic_loaded ~= true |
| 104 |
or config.lualibs.force_reload == true |
| 105 |
then |
| 106 |
loadmodule"lualibs-basic.lua" |
| 107 |
loadmodule"lualibs-compat.lua" --- restore stuff gone since v1.* |
| 108 |
end |
| 109 |
|
| 110 |
if lualibs.load_extended == true |
| 111 |
and lualibs.extended_loaded ~= true |
| 112 |
or config.lualibs.force_reload == true |
| 113 |
then |
| 114 |
loadmodule"lualibs-extended.lua" |
| 115 |
end |
| 116 |
|
| 117 |
--- This restores the default of loading everything should a package |
| 118 |
--- have requested otherwise. Will be gone once there is a canonical |
| 119 |
--- interface for parameterized loading of libraries. |
| 120 |
config.lualibs.load_extended = true |
| 121 |
|
| 122 |
-- vim:tw=71:sw=2:ts=2:expandtab |
| 123 |
|
| 124 |
-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 125 |
-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 126 |
-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 127 |
-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 128 |
-- |
| 129 |
-- End of File `lualibs.lua'. |