v2.6.0 - Added support for reading low endian numbers from files, and fixed some bugs with the Unicode library.

This commit is contained in:
Ponali
2025-07-20 17:20:12 +02:00
parent 2965d62655
commit 68e5b70273
4 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
local agcfg = { local agcfg = {
["halyde"] = { ["halyde"] = {
["maindir"] = "", ["maindir"] = "",
["version"] = "2.5.0", ["version"] = "2.6.0",
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.", ["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
["directories"] = { ["directories"] = {
"halyde/apps", "halyde/apps",
+1 -1
View File
@@ -1,7 +1,7 @@
local loadfile = ... local loadfile = ...
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile) local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
_G._OSVERSION = "Halyde 2.5.0" _G._OSVERSION = "Halyde 2.6.0"
_G._OSLOGO = "" _G._OSLOGO = ""
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
repeat repeat
+8 -2
View File
@@ -88,8 +88,14 @@ local function readBytes(self,n)
return string.byte(byte) return string.byte(byte)
end end
local bytes, res = {string.byte(self:read(n),1,n)}, 0 local bytes, res = {string.byte(self:read(n),1,n)}, 0
for i=1,#bytes do if self.littleEndian then
res = (res<<8)&0xFFFFFFFF | bytes[i] for i=#bytes,1,-1 do
res = (res<<8)&0xFFFFFFFF | bytes[i]
end
else
for i=1,#bytes do
res = (res<<8)&0xFFFFFFFF | bytes[i]
end
end end
return res return res
end end
+4 -2
View File
@@ -9,6 +9,8 @@ else
end end
function unicodeLib.readCodePoint(readByte) function unicodeLib.readCodePoint(readByte)
checkArg(1,readByte,"function")
local function inRange(min,max,...) local function inRange(min,max,...)
for _,v in ipairs({...}) do for _,v in ipairs({...}) do
if not (v and v>=min and v<max) then return false end if not (v and v>=min and v<max) then return false end
@@ -61,9 +63,9 @@ function unicodeLib.readChar(readByte)
end end
function unicodeLib.codepoint(chr) function unicodeLib.codepoint(chr)
checkArg(1,readByte,"string") checkArg(1,chr,"string")
local ptr = 1 local ptr = 1
return readUniChar(function() return unicode.readCodePoint(function()
local byte = chr:byte(ptr) local byte = chr:byte(ptr)
ptr=ptr+1 ptr=ptr+1
return byte return byte