diff options
author | Karl Berry <karl@freefriends.org> | 2017-05-10 17:56:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-05-10 17:56:24 +0000 |
commit | 347d616d3cb26d19d9c79f8b0439712cf5f9012b (patch) | |
tree | 7e7766f16f342eb6a8fb4824d3c9e8376a65f2f1 /Master/texmf-dist/tex/context/base/mkiv/util-fil.lua | |
parent | b74dd6fa976d54286d0465def3cbd3a725770307 (diff) |
context (May 9 10:39)
git-svn-id: svn://tug.org/texlive/trunk@44279 c570f23f-e606-0410-a88d-b1316a301751
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.lua | 30 |
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 |