rename MTUL to LEEF

This commit is contained in:
FatalErr42O 2024-12-01 12:43:12 -08:00
parent 214adf20f4
commit c43700d8ce
10 changed files with 49 additions and 49 deletions

View File

@ -1,4 +1,4 @@
# MTUL-core
core dependencies for other libraries within MTUL. This is mostly useless atm, just adds binary reading from modlib.
# leef-core
core dependencies for other libraries within leef. This is mostly useless atm, just adds binary reading from modlib.
Credits to Appgurue: he basically wrote all original code, it's been highly modified to be modular and to have a working documented interface- but nonetheless none of it would be possible without him.
documentation: https://minetest-unification-library.github.io/MTUL-filesystem/
documentation: https://minetest-unification-library.github.io/leef-filesystem/

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>MTUL filesystem</title>
<title>leef filesystem</title>
<link rel="stylesheet" href="ldoc.css" type="text/css" />
</head>
<body>
@ -24,7 +24,7 @@
<div id="navigation">
<br/>
<h1>MTUL filesystem</h1>
<h1>leef filesystem</h1>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>MTUL filesystem</title>
<title>leef filesystem</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -24,7 +24,7 @@
<div id="navigation">
<br/>
<h1>MTUL filesystem</h1>
<h1>leef filesystem</h1>
<ul>
@ -51,7 +51,7 @@
<h1>Module <code>binary</code></h1>
<p>read and write (little endian) binary.</p>
<p> located in <code>mtul.binary</code>.</p>
<p> located in <code>leef.binary</code>.</p>
<h2><a href="#reading_binary_inputs">reading binary inputs </a></h2>

View File

@ -3,7 +3,7 @@
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>MTUL filesystem</title>
<title>leef filesystem</title>
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
</head>
<body>
@ -24,7 +24,7 @@
<div id="navigation">
<br/>
<h1>MTUL filesystem</h1>
<h1>leef filesystem</h1>
<ul>

View File

@ -1,13 +1,13 @@
mtul = mtul or {
leef = leef or {
loaded_modules = {}
}
--initialize namespace vars if not present.
mtul.binary = mtul.binary or {}
mtul.utils = mtul.utils or {}
mtul.paths = mtul.paths or {}
mtul.loaded_modules.filesystem = true
--run files. These will directly modify the mtul sub tables.
local path = minetest.get_modpath("mtul_filesystem")
leef.binary = leef.binary or {}
leef.utils = leef.utils or {}
leef.paths = leef.paths or {}
leef.loaded_modules.filesystem = true
--run files. These will directly modify the leef sub tables.
local path = minetest.get_modpath("leef_filesystem")
dofile(path.."/modlib/binary.lua")
dofile(path.."/modlib/mod_utils.lua")
dofile(path.."/modlib/paths.lua")

View File

@ -1,5 +1,5 @@
project="MTUL filesystem"
title="MTUL filesystem"
project="leef filesystem"
title="leef filesystem"
description="implements essential tools for locating and reading files"
format="markdown"
backtick_references=false

View File

@ -1,4 +1,4 @@
name = mtul_filesystem
title = MTUL filesystem
description = adds dependencies for binary file reading, as well as other file utilities.
author = FatalError42O, (coded by Appgurue)
name = leef_filesystem
title = LEEF filesystem
description = adds dependencies for binary file reading, as well as other file utilities. Orignally from Modlib
author = FatalistError, Appgurue

View File

@ -1,5 +1,5 @@
--- read and write (little endian) binary.
--- located in `mtul.binary`.
--- located in `leef.binary`.
--@module binary
local assert, math_huge, math_frexp, math_floor
@ -17,7 +17,7 @@ local positive_nan = negative_nan ^ 1
--- read an IEEE 754 single precision (32-bit) floating point number
-- @function read_single
-- @param function @{read_byte}
function mtul.binary.read_single(read_byte)
function leef.binary.read_single(read_byte)
-- First read the mantissa
local mantissa = read_byte() / 0x100
mantissa = (mantissa + read_byte()) / 0x100
@ -54,7 +54,7 @@ end
--- read an IEEE 754 double-precision (64-bit) floating point number
-- @function read_double
-- @param function @{read_byte}
function mtul.binary.read_double(read_byte)
function leef.binary.read_double(read_byte)
-- First read the mantissa
local mantissa = 0
for _ = 1, 6 do
@ -91,7 +91,7 @@ end
-- @function read_uint
-- @param function @{read_byte}
-- @param int length in bytes of unsigned integer
function mtul.binary.read_uint(read_byte, bytes)
function leef.binary.read_uint(read_byte, bytes)
local factor = 1
local uint = 0
for _ = 1, bytes do
@ -105,8 +105,8 @@ end
-- @function read_uint
-- @param function @{read_byte}
-- @param int length in bytes of integer
function mtul.binary.read_int(read_byte, bytes)
local uint = mtul.binary.read_uint(read_byte, bytes)
function leef.binary.read_int(read_byte, bytes)
local uint = leef.binary.read_uint(read_byte, bytes)
local max = 0x100 ^ bytes
if uint >= max / 2 then
return uint - max
@ -118,7 +118,7 @@ end
-- documentation needed
-- @section write
-- @fixme add documentation
function mtul.binary.write_uint(write_byte, uint, bytes)
function leef.binary.write_uint(write_byte, uint, bytes)
for _ = 1, bytes do
write_byte(uint % 0x100)
uint = math_floor(uint / 0x100)
@ -126,7 +126,7 @@ function mtul.binary.write_uint(write_byte, uint, bytes)
assert(uint == 0)
end
function mtul.binary.write_int(write_byte, int, bytes)
function leef.binary.write_int(write_byte, int, bytes)
local max = 0x100 ^ bytes
if int < 0 then
assert(-int <= max / 2)
@ -134,10 +134,10 @@ function mtul.binary.write_int(write_byte, int, bytes)
else
assert(int < max / 2)
end
return mtul.binary.write_uint(write_byte, int, bytes)
return leef.binary.write_uint(write_byte, int, bytes)
end
function mtul.binary.write_single(write_byte, number)
function leef.binary.write_single(write_byte, number)
if number ~= number then -- nan: all ones
for _ = 1, 4 do write_byte(0xFF) end
return
@ -189,7 +189,7 @@ function mtul.binary.write_single(write_byte, number)
write_byte(sign_byte)
end
function mtul.binary.write_double(write_byte, number)
function leef.binary.write_double(write_byte, number)
if number ~= number then -- nan: all ones
for _ = 1, 8 do write_byte(0xFF) end
return
@ -240,8 +240,8 @@ function mtul.binary.write_double(write_byte, number)
write_byte(sign_byte)
end
function mtul.binary.write_float(write_byte, number, double)
(double and mtul.binary.write_double or mtul.binary.write_single)(write_byte, number)
function leef.binary.write_float(write_byte, number, double)
(double and leef.binary.write_double or leef.binary.write_single)(write_byte, number)
end
--- misc binary helpers
@ -251,7 +251,7 @@ end
-- @function fround()
-- @param number
-- @return nearest 32-bit single precision float representation of a number
function mtul.binary.fround(number)
function leef.binary.fround(number)
if number == 0 or number ~= number then
return number
end

View File

@ -1,5 +1,5 @@
function mtul.utils.get_resource(modname, resource, ...)
function leef.utils.get_resource(modname, resource, ...)
if not resource then
resource = modname
modname = minetest.get_current_modname()
@ -11,7 +11,7 @@ local function trim_spacing(text)
end
--I will add a file reading lib eventually...
local read_file = function(mod, filename)
local filepath = mtul.utils.get_resource(mod, filename)
local filepath = leef.utils.get_resource(mod, filename)
local file, err = io.open(filename, "r")
if file == nil then return nil, err end
local content = file:read"*a"
@ -19,14 +19,14 @@ local read_file = function(mod, filename)
end
local mod_info
function mtul.utils.get_mod_info()
function leef.utils.get_mod_info()
if mod_info then return mod_info end
mod_info = {}
-- TODO validate modnames
local modnames = minetest.get_modnames()
for _, mod in pairs(modnames) do
local info
local mod_conf = Settings(mtul.utils.get_resource(mod, "mod.conf"))
local mod_conf = Settings(leef.utils.get_resource(mod, "mod.conf"))
if mod_conf then
info = {}
mod_conf = mod_conf:to_table()
@ -65,10 +65,10 @@ function mtul.utils.get_mod_info()
return mod_info
end
local mod_load_order
function mtul.utils.get_mod_load_order()
function leef.utils.get_mod_load_order()
if mod_load_order then return mod_load_order end
mod_load_order = {}
local mod_info = mtul.utils.get_mod_info()
local mod_info = leef.utils.get_mod_info()
-- If there are circular soft dependencies, it is possible that a mod is loaded, but not in the right order
-- TODO somehow maximize the number of soft dependencies fulfilled in case of circular soft dependencies
local function load(mod)

View File

@ -43,7 +43,7 @@ local function collect_media(modname)
end
end
for _, foldername in ipairs(media_foldernames) do -- order matters!
traverse(mtul.utils.get_resource(modname, foldername))
traverse(leef.utils.get_resource(modname, foldername))
end
return media
end
@ -53,7 +53,7 @@ local paths = {}
local mods = {}
local overridden_paths = {}
local mods_with_overriden_media = {}
for _, mod in ipairs(mtul.utils.get_mod_load_order()) do
for _, mod in ipairs(leef.utils.get_mod_load_order()) do
local mod_media = collect_media(mod.name)
for medianame, path in pairs(mod_media) do
if paths[medianame] then
@ -74,7 +74,7 @@ end
-- }
-- NOTE: "loaded" meaning the final mediapath- what the client loads.
-- @table media_paths
mtul.paths.media_paths = paths
leef.paths.media_paths = paths
---modname by media.
-- a list of mods by indexed by the name of loaded media
@ -83,7 +83,7 @@ mtul.paths.media_paths = paths
-- }
-- @table modname_by_media
-- NOTE: "loaded" meaning the final mediapath- what the client loads.
mtul.paths.modname_by_media = mods
leef.paths.modname_by_media = mods
--- overriden media paths.
-- a list of media paths that were overriden by conflicting model names- the unloaded media, i.e:
@ -93,7 +93,7 @@ mtul.paths.modname_by_media = mods
-- }
-- }
-- @table overriden_media_paths
mtul.paths.overriden_media_paths = overridden_paths
leef.paths.overriden_media_paths = overridden_paths
--- mods with overriden media (indexed by media).
-- a list of mods that have overriden media, by media names
@ -103,4 +103,4 @@ mtul.paths.overriden_media_paths = overridden_paths
-- }
-- }
-- @table overriden_media_paths
mtul.paths.mods_with_overriden_media = mods_with_overriden_media
leef.paths.mods_with_overriden_media = mods_with_overriden_media