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
ENGINE="$(which luametatex)"
ENGINE="$(which luametatex$EXE_EXT)"
ENGINE_DIR="$(dirname "$ENGINE")"
REPO="$(pwd)"
cd "$(dirname "$ENGINE")"
ln -s luametatex luametaplain
ln -s luametatex luametalatex
ln -s luametatex luametalatex-dev
ln -s luametatex$EXE_EXT luametaplain$EXE_EXT
ln -s luametatex$EXE_EXT luametalatex$EXE_EXT
ln -s luametatex$EXE_EXT luametalatex-dev$EXE_EXT
ln -s "$REPO/luametaplain.lua" .
ln -s "$REPO/luametalatex.lua" .
ln -s "$REPO/luametalatex-dev.lua" .

View File

@ -40,7 +40,7 @@ do
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)
local f = io.open(name)
local f = io.open(name, 'r')
return setmetatable({
reader = function()
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 encfile = white^0*lname*white^0*namearray*white^0*'def'*white^0*-1
return function(filename)
local file = io.open(filename)
local file = io.open(filename, 'r')
local name, encoding = encfile:match(file:read'a')
file:close()
return encoding, name

View File

@ -119,7 +119,7 @@ local function parse_maintable(offset, str)
end
return function(filename)
local file = io.open(filename)
local file = io.open(filename, 'rb')
local _, length = string.unpack("<I2I4", file:read(6))
local preface = file:read(length)
_, 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)
local filename = kpse.find_file(name, 'tfm', true)
if not filename then return end
local f = io.open(filename)
local f = io.open(filename, 'rb')
if not f then return end
local buf = f:read'*a'
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)
local filename = kpse.find_file(name, 'vf', must_exist)
if not filename then return end
local f = io.open(filename)
local f = io.open(filename, 'rb')
if not f then return end
local buf = f:read'*a'
f:close()

View File

@ -581,7 +581,7 @@ end
-- file: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)
local file = io.open(filename)
local file = io.open(filename, 'rb')
local buf = file:read'a'
local i = 1
file:close()

View File

@ -38,7 +38,7 @@ local function mapfile(filename, operator)
if not operator then
operator, filename = optoperator:match(filename)
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
file:close()
end

View File

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

View File

@ -204,7 +204,7 @@ end
local png_functions = {}
function png_functions.scan(img)
local file = io.open(img.filepath)
local file = io.open(img.filepath, 'rb')
if not file then
error[[PDF image could not be opened.]]
end
@ -228,7 +228,7 @@ local intents = {[0]=
}
local function srgb_lookup(pfile, intent)
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'
f:close()
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
function png_functions.write(pfile, img)
local file = io.open(img.filepath)
local file = io.open(img.filepath, 'rb')
if not file then
error[[PDF image could not be opened.]]
end

View File

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