MAJOR=4 MINOR=2 DEVNAME=tty2 8ˆl–ßi~”ªe¶¥2 �p ¸&ÔÅ£�þFóN6³rÊ!¤ŠÐ?Ÿ¿ …qçÄÛ?ÄÂÁ?÷#!/usr/bin/env texlua if not modules then modules = { } end modules ['mtxrun'] = { version = 1.001, comment = "runner, lua replacement for texmfstart.rb", author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", copyright = "PRAGMA ADE / ConTeXt Development Team", license = "see context related readme files" } -- one can make a stub: -- mtxrun : -- -- #!/bin/sh -- env LUATEXDIR=/....../texmf/scripts/context/lua luatex --luaonly mtxrun.lua "$@" -- mtxrun.cmd : -- -- @luatex --luaonly %~d0%~p0mtxrun.lua %* -- filename : mtxrun.lua -- comment : companion to context.tex -- author : Hans Hagen, PRAGMA-ADE, Hasselt NL -- copyright: PRAGMA ADE / ConTeXt Development Team -- license : see context related readme files -- This script is based on texmfstart.rb but does not use kpsewhich to locate files. -- Although kpse is a library it never came to opening up its interface to other -- programs (esp scripting languages) and so we do it ourselves. The lua variant -- evolved out of an experimental ruby one. Interesting is that using a scripting -- language instead of c does not have a speed penalty. Actually the lua variant is -- more efficient, especially when multiple calls to kpsewhich are involved. The lua -- library also gives way more control. -- When libraries used here are updates you can run -- -- mtxrun --selfmerge -- -- to update the embedded code. After that you might need to run -- -- mtxrun --selfupdate -- -- to copy the new script (from scripts/context/lua) to location where -- binaries are expected. If you want to remove the embedded code you can run -- -- mtxxun --selfclean -- to be done / considered -- -- support for --exec or make it default -- support for jar files (or maybe not, never used, too messy) -- support for $RUBYINPUTS cum suis (if still needed) -- remember for subruns: _CTX_K_V_#{original}_ -- remember for subruns: _CTX_K_S_#{original}_ -- remember for subruns: TEXMFSTART.#{original} [tex.rb texmfstart.rb] -- begin library merge do -- create closure to overcome 200 locals limit package.loaded["l-bit32"] = package.loaded["l-bit32"] or true -- original size: 3607, stripped down to: 3009 if not modules then modules={} end modules ['l-bit32']={ version=1.001, license="the same as regular Lua", source="bitwise.lua, v 1.24 2014/12/26 17:20:53 roberto", comment="drop-in for bit32, adapted a bit by Hans Hagen", } if bit32 then elseif utf8 then load ([[ local select = select -- instead of: arg = { ... } bit32 = { bnot = function (a) return ~a & 0xFFFFFFFF end, band = function (x, y, z, ...) if not z then return ((x or -1) & (y or -1)) & 0xFFFFFFFF else local res = x & y & z for i=1,select("#",...) do res = res & select(i,...) end return res & 0xFFFFFFFF end end, bor = function (x, y, z, ...) if not z then return ((x or 0) | (y or 0)) & 0xFFFFFFFF else local res = x | y | z for i=1,select("#",...) do res = res | select(i,...) end return res & 0xFFFFFFFF end end, bxor = function (x, y, z, ...) if not z then return ((x or 0) ~ (y or 0)) & 0xFFFFFFFF else local res = x ~ y ~ z for i=1,select("#",...) do res = res ~ select(i,...) end return res & 0xFFFFFFFF end end, btest = function (x, y, z, ...) if not z then return (((x or -1) & (y or -1)) & 0xFFFFFFFF) ~= 0 else local res = x & y & z for i=1,select("#",...) do res = res & select(i,...) end return (res & 0xFFFFFFFF) ~= 0 end end, lshift = function (a, b) return ((a & 0xFFFFFFFF) << b) & 0xFFFFFFFF end, rshift = function (a, b) return ((a & 0xFFFFFFFF) >> b) & 0xFFFFFFFF end, arshift = function (a, b) a = a & 0xFFFFFFFF if b <= 0 or (a & 0x80000000) == 0 then return (a >> b) & 0xFFFFFFFF else return ((a >> b) | ~(0xFFFFFFFF >> b)) & 0xFFFFFFFF end