Debian Codegraph @

texmf-dist/tex/luatex/lualibs/lualibs-extended.lua

raw
1 --
2 -- This is file `lualibs-extended.lua',
3 -- generated with the docstrip utility.
4 --
5 -- The original source files were:
6 --
7 -- lualibs.dtx (with options: `extended')
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 -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28 lualibs = lualibs or { }
29
30
31 local lualibs_extended_module = {
32 name = "lualibs-extended",
33 version = "2.76", --TAGVERSION
34 date = "2023-07-13", --TAGDATE
35 description = "ConTeXt Lua libraries -- extended collection.",
36 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL & Elie Roux & Philipp Gesang",
37 copyright = "PRAGMA ADE / ConTeXt Development Team",
38 license = "See ConTeXt's mreadme.pdf for the license",
39 }
40
41 local stringformat = string.format
42 local loadmodule = lualibs.loadmodule
43 local texiowrite = texio.write
44 local texiowrite_nl = texio.write_nl
45
46
47 local error, logger, mklog
48 if luatexbase and luatexbase.provides_module then
49 --- TODO test how those work out when running tex
50 local __error,_,_,__logger =
51 luatexbase.provides_module(lualibs_extended_module)
52 error = __error
53 logger = __logger
54 mklog = function ( ) return logger end
55 else
56 mklog = function (t)
57 local prefix = stringformat("[%s] ", t)
58 return function (...)
59 texiowrite_nl(prefix)
60 texiowrite (stringformat(...))
61 end
62 end
63 error = mklog"ERROR"
64 logger = mklog"INFO"
65 end
66
67 local info = lualibs.info
68
69
70 local dummy_function = function ( ) end
71 local newline = function ( ) texiowrite_nl"" end
72
73 local fake_logs = function (name)
74 return {
75 name = name,
76 enable = dummy_function,
77 disable = dummy_function,
78 reporter = mklog,
79 newline = newline
80 }
81 end
82
83 local fake_trackers = function (name)
84 return {
85 name = name,
86 enable = dummy_function,
87 disable = dummy_function,
88 register = mklog,
89 newline = newline,
90 }
91 end
92
93 local backup_store = { }
94
95 local fake_context = function ( )
96 if logs then backup_store.logs = logs end
97 if trackers then backup_store.trackers = trackers end
98 logs = fake_logs"logs"
99 trackers = fake_trackers"trackers"
100 end
101
102 local unfake_context = function ( )
103 if backup_store then
104 local bl, bt = backup_store.logs, backup_store.trackers
105 if bl then logs = bl end
106 if bt then trackers = bt end
107 end
108 end
109
110 fake_context()
111
112 local loaded = false
113 if lualibs.prefer_merged then
114 info"Loading merged package for collection “extended”."
115 loaded = loadmodule('lualibs-extended-merged.lua')
116 else
117 info"Ignoring merged packages."
118 info"Falling back to individual libraries from collection “extended”."
119 end
120
121 if loaded == false then
122 loadmodule("lualibs-util-sac.lua")--- streams: string based file parsers
123 loadmodule("lualibs-util-str.lua")--- string formatters (fast)
124 loadmodule("lualibs-util-fil.lua")--- extra file helpers
125 loadmodule("lualibs-util-tab.lua")--- extended table operations
126 loadmodule("lualibs-util-sto.lua")--- storage (hash allocation)
127 ----------("lualibs-util-pck.lua")---!packers; necessary?
128 ----------("lualibs-util-seq.lua")---!sequencers (function chaining)
129 ----------("lualibs-util-mrg.lua")---!only relevant in mtx-package
130 loadmodule("lualibs-util-prs.lua")--- miscellaneous parsers; cool. cool cool cool
131 ----------("lualibs-util-fmt.lua")---!column formatter (rarely used)
132 loadmodule("lualibs-util-dim.lua")--- conversions between dimensions
133 loadmodule("lualibs-util-jsn.lua")--- JSON parser
134
135 ----------("lualibs-trac-set.lua")---!generalization of trackers
136 ----------("lualibs-trac-log.lua")---!logging
137 loadmodule("lualibs-trac-inf.lua")--- timing/statistics
138 loadmodule("lualibs-util-lua.lua")--- operations on lua bytecode
139 loadmodule("lualibs-util-deb.lua")--- extra debugging
140 loadmodule("lualibs-util-tpl.lua")--- templating
141 loadmodule("lualibs-util-sta.lua")--- stacker (for writing pdf)
142 loadmodule("lualibs-util-zip.lua")--- compression and zip files
143 end
144
145 unfake_context() --- TODO check if this works at runtime
146
147 lualibs.extended_loaded = true
148 -- vim:tw=71:sw=2:ts=2:expandtab
149
150 --
151 -- End of File `lualibs-extended.lua'.