1 local _setfenv
, _ipairs
, _loadstr
= setfenv
, ipairs
, loadstring
3 local _match
, _gmatch
, _fmt
= string.match
, string.gmatch
, string.format
4 local _gsub
, _sub
= string.gsub, string.sub
5 local _exec
= os
.execute
7 local function readfile(n
)
8 local f
= _open(n
) or _open("tools/"..n
)
9 local ctnt
= f
:read("*a")
14 local srcname
, N
, dstname
= ...
15 if N
== "32" or N
== "64" then
19 if (srcname
== nil or srcname
== "") then
20 srcname
= "..\\include\\vmjit_x86_xx_insids.lh"
22 if dstname
== nil or dstname
== "" then
23 dstname
= _match(_gsub(srcname
, "xx", N
), "^(.-)%.[^.\\/]*$") .. ".h"
26 local emblua
= _loadstr(readfile("emblua.lua"))
27 local oldtext
= readfile(srcname
)
28 oldtext
= _gsub(oldtext
, "%$%$%$", N
)
29 local newtext
= emblua({type = "string", value
= oldtext
, file
= srcname
},{type="string"})
31 local f
= _open(dstname
, "w")