Windows needs a flag for binary files

This commit is contained in:
Marcel Krüger 2020-07-09 14:53:17 +02:00
parent 071cbe4ce4
commit 6781dabe7b
11 changed files with 18 additions and 18 deletions

View File

@ -1,11 +1,11 @@
#!/bin/sh #!/bin/sh
ENGINE="$(which luametatex)" ENGINE="$(which luametatex$EXE_EXT)"
ENGINE_DIR="$(dirname "$ENGINE")" ENGINE_DIR="$(dirname "$ENGINE")"
REPO="$(pwd)" REPO="$(pwd)"
cd "$(dirname "$ENGINE")" cd "$(dirname "$ENGINE")"
ln -s luametatex luametaplain ln -s luametatex$EXE_EXT luametaplain$EXE_EXT
ln -s luametatex luametalatex ln -s luametatex$EXE_EXT luametalatex$EXE_EXT
ln -s luametatex luametalatex-dev ln -s luametatex$EXE_EXT luametalatex-dev$EXE_EXT
ln -s "$REPO/luametaplain.lua" . ln -s "$REPO/luametaplain.lua" .
ln -s "$REPO/luametalatex.lua" . ln -s "$REPO/luametalatex.lua" .
ln -s "$REPO/luametalatex-dev.lua" . ln -s "$REPO/luametalatex-dev.lua" .

View File

@ -40,7 +40,7 @@ do
end end
-- callback_register('read_data_file', function(name) error[[TODO]]return kpse.find_file(name, 'tex', true) end) -- callback_register('read_data_file', function(name) error[[TODO]]return kpse.find_file(name, 'tex', true) end)
callback_register('open_data_file', function(name) callback_register('open_data_file', function(name)
local f = io.open(name) local f = io.open(name, 'r')
return setmetatable({ return setmetatable({
reader = function() reader = function()
local line = f:read() local line = f:read()

View File

@ -5,7 +5,7 @@ local lname = '/' * name / 1
local namearray = lpeg.Ct('['*white^0*lpeg.Cg(lname*white^0, 0)^-1*(lname*white^0)^0*']') local namearray = lpeg.Ct('['*white^0*lpeg.Cg(lname*white^0, 0)^-1*(lname*white^0)^0*']')
local encfile = white^0*lname*white^0*namearray*white^0*'def'*white^0*-1 local encfile = white^0*lname*white^0*namearray*white^0*'def'*white^0*-1
return function(filename) return function(filename)
local file = io.open(filename) local file = io.open(filename, 'r')
local name, encoding = encfile:match(file:read'a') local name, encoding = encfile:match(file:read'a')
file:close() file:close()
return encoding, name return encoding, name

View File

@ -119,7 +119,7 @@ local function parse_maintable(offset, str)
end end
return function(filename) return function(filename)
local file = io.open(filename) local file = io.open(filename, 'rb')
local _, length = string.unpack("<I2I4", file:read(6)) local _, length = string.unpack("<I2I4", file:read(6))
local preface = file:read(length) local preface = file:read(length)
_, length = string.unpack("<I2I4", file:read(6)) _, length = string.unpack("<I2I4", file:read(6))

View File

@ -143,7 +143,7 @@ local basename = ((1-lpeg.S'\\/')^0*lpeg.S'\\/')^0*lpeg.C((1-lpeg.P'.tfm'*-1)^0)
return function(name, size) return function(name, size)
local filename = kpse.find_file(name, 'tfm', true) local filename = kpse.find_file(name, 'tfm', true)
if not filename then return end if not filename then return end
local f = io.open(filename) local f = io.open(filename, 'rb')
if not f then return end if not f then return end
local buf = f:read'*a' local buf = f:read'*a'
f:close() f:close()

View File

@ -168,7 +168,7 @@ local basename = ((1-lpeg.S'\\/')^0*lpeg.S'\\/')^0*lpeg.C((1-lpeg.P'.tfm'*-1)^0)
return function(name, size, must_exist) return function(name, size, must_exist)
local filename = kpse.find_file(name, 'vf', must_exist) local filename = kpse.find_file(name, 'vf', must_exist)
if not filename then return end if not filename then return end
local f = io.open(filename) local f = io.open(filename, 'rb')
if not f then return end if not f then return end
local buf = f:read'*a' local buf = f:read'*a'
f:close() f:close()

View File

@ -581,7 +581,7 @@ end
-- file:close() -- file:close()
-- io.open(arg[3], 'w'):write(myfunc(buf, 1, 1, nil, {{3}, {200}, {1000}, {1329}, {1330}, {1331}})):close() -- io.open(arg[3], 'w'):write(myfunc(buf, 1, 1, nil, {{3}, {200}, {1000}, {1329}, {1330}, {1331}})):close()
return function(filename, fontid, encoding) return function(fontdir, usedcids) return function(filename, fontid, encoding) return function(fontdir, usedcids)
local file = io.open(filename) local file = io.open(filename, 'rb')
local buf = file:read'a' local buf = file:read'a'
local i = 1 local i = 1
file:close() file:close()

View File

@ -38,7 +38,7 @@ local function mapfile(filename, operator)
if not operator then if not operator then
operator, filename = optoperator:match(filename) operator, filename = optoperator:match(filename)
end end
local file = io.open(kpse.find_file(filename, 'map')) local file = io.open(kpse.find_file(filename, 'map'), 'r')
for line in file:lines() do mapline(line, operator) end for line in file:lines() do mapline(line, operator) end
file:close() file:close()
end end

View File

@ -68,7 +68,7 @@ local function readpostnames(buf, i, usedcids, encoding)
return newusedcids return newusedcids
end end
return function(filename, fontid, reencode) return function(filename, fontid, reencode)
local file = io.open(filename) local file = io.open(filename, 'rb')
local buf = file:read'a' local buf = file:read'a'
file:close() file:close()
local magic, tables = sfnt.parse(buf, 1, fontid) local magic, tables = sfnt.parse(buf, 1, fontid)

View File

@ -204,7 +204,7 @@ end
local png_functions = {} local png_functions = {}
function png_functions.scan(img) function png_functions.scan(img)
local file = io.open(img.filepath) local file = io.open(img.filepath, 'rb')
if not file then if not file then
error[[PDF image could not be opened.]] error[[PDF image could not be opened.]]
end end
@ -228,7 +228,7 @@ local intents = {[0]=
} }
local function srgb_lookup(pfile, intent) local function srgb_lookup(pfile, intent)
if not srgb_colorspace then if not srgb_colorspace then
local f = io.open(kpse.find_file'sRGB.icc.zlib') local f = io.open(kpse.find_file'sRGB.icc.zlib', 'rb')
local profile = f:read'a' local profile = f:read'a'
f:close() f:close()
local objnum = pfile:stream(nil, '/Filter/FlateDecode/N ' .. tostring(colortype & 2 == 2 and '3' or '1'), t.iCCP, nil, true) local objnum = pfile:stream(nil, '/Filter/FlateDecode/N ' .. tostring(colortype & 2 == 2 and '3' or '1'), t.iCCP, nil, true)
@ -259,7 +259,7 @@ local function rawimage(t, content)
end end
function png_functions.write(pfile, img) function png_functions.write(pfile, img)
local file = io.open(img.filepath) local file = io.open(img.filepath, 'rb')
if not file then if not file then
error[[PDF image could not be opened.]] error[[PDF image could not be opened.]]
end end

View File

@ -23,7 +23,7 @@ local function stream(pdf, num, dict, content, isfile, raw)
end end
pdf[num] = {offset = pdf.file:seek()} pdf[num] = {offset = pdf.file:seek()}
if isfile then if isfile then
local f = io.open(content) local f = io.open(content, 'rb')
content = f:read'a' content = f:read'a'
f:close() f:close()
end end
@ -56,7 +56,7 @@ local function indirect(pdf, num, content, isfile, objstream)
error[[Invalid object]] error[[Invalid object]]
end end
if isfile then if isfile then
local f = io.open(content) local f = io.open(content, 'rb')
content = f:read'a' content = f:read'a'
f:close() f:close()
end end
@ -165,7 +165,7 @@ local pdfmeta = {
} }
pdfmeta.__index = pdfmeta pdfmeta.__index = pdfmeta
local function open(filename) local function open(filename)
local file = io.open(filename, 'w') local file = io.open(filename, 'wb')
file:write"%PDF-X.X\n%🖋\n" file:write"%PDF-X.X\n%🖋\n"
return setmetatable({file = file, version = '1.7', [0] = 0, pages = {}, objstream = {}}, pdfmeta) return setmetatable({file = file, version = '1.7', [0] = 0, pages = {}, objstream = {}}, pdfmeta)
end end