summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/util-fil.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/mkiv/util-fil.lua30
1 files changed, 24 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua b/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua
index de3c999b72e..01bcd571e9a 100644
--- a/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua
+++ b/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua
@@ -195,23 +195,41 @@ function files.readinteger4le(f)
end
end
+-- function files.readfixed2(f)
+-- local a, b = byte(f:read(2),1,2)
+-- if a >= 0x80 then
+-- return (0x100 * a + b - 0x10000)/256.0
+-- else
+-- return (0x100 * a + b)/256.0
+-- end
+-- end
+
function files.readfixed2(f)
local a, b = byte(f:read(2),1,2)
if a >= 0x80 then
- return (0x100 * a + b - 0x10000)/256.0
+ return (a - 0x100) + b/0x100
else
- return (0x100 * a + b)/256.0
+ return (a ) + b/0x100
end
end
-- (real) (n>>16) + ((n&0xffff)/65536.0))
+-- function files.readfixed4(f)
+-- local a, b, c, d = byte(f:read(4),1,4)
+-- if a >= 0x80 then
+-- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000)/65536.0
+-- else
+-- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d)/65536.0
+-- end
+-- end
+
function files.readfixed4(f)
local a, b, c, d = byte(f:read(4),1,4)
if a >= 0x80 then
- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000)/65536.0
+ return (0x100 * a + b - 0x10000) + (0x100 * c + d)/0x10000
else
- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d)/65536.0
+ return (0x100 * a + b ) + (0x100 * c + d)/0x10000
end
end
@@ -281,8 +299,8 @@ if fio and fio.readcardinal1 then
files.readinteger2 = fio.readinteger2
files.readinteger3 = fio.readinteger3
files.readinteger4 = fio.readinteger4
- files.readfixed2 = fio.readfixed2
- files.readfixed4 = fio.readfixed4
+ -- files.readfixed2 = fio.readfixed2 -- needs recent luatex
+ -- files.readfixed4 = fio.readfixed4 -- needs recent luatex
files.read2dot14 = fio.read2dot14
files.setposition = fio.setposition
files.getposition = fio.getposition