1if not modules then modules = { } end modules ['libs-imp-lz4'] = {
2 version = 1.001,
3 comment = "companion to luat-lib.mkxl",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9
10
11
12
13
14local libname = "lz4"
15local libfile = "liblz4"
16
17local lz4lib = resolvers.libraries.validoptional(libname)
18
19if not lz4lib then return end
20
21local lz4_compress = lz4lib.compress
22
23local lz4_decompresssize = lz4lib.decompresssize
24local lz4_framecompress = lz4lib.framecompress
25local lz4_framedecompress = lz4lib.framedecompress
26
27local function okay()
28 if resolvers.libraries.optionalloaded(libname,libfile) then
29 okay = function() return true end
30 else
31 okay = function() return false end
32 end
33 return okay()
34end
35
36local lz4 = {
37 compress = function (...) return okay() and lz4_compress (...) end,
38
39 decompresssize = function (...) return okay() and lz4_decompresssize (...) end,
40 framecompress = function (...) return okay() and lz4_framecompress (...) end,
41 framedecompress = function (...) return okay() and lz4_framedecompress(...) end,
42}
43
44package.loaded[libname] = lz4
45
46return lz4
47 |