-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkct-uni-1.lua
executable file
·32 lines (29 loc) · 1.03 KB
/
kct-uni-1.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env texlua
local tbl = io.open(arg[1], 'r')
local out = io.open(arg[2], 'w')
local jis, uni, buf
buf = {}
for line in tbl:lines() do
if line:match ('0x2[0-9A-D]....*Fullwidth: U%+....') then
jis, uni = line:match ('0x(2[0-9A-D]...).*Fullwidth: U%+(....)')
buf[#buf+1] = {tonumber(uni,16), jis, uni, ' F' }
elseif line:match('0x2[0-9A-D]...%s*U.....%s') then
jis, uni = line:match ('0x(2[0-9A-D]...)%s*U%+(....)')
buf[#buf+1] = {tonumber(uni,16), jis, uni, ' !' }
end
if line:match ('0x2[0-9A-D]....*Windows: U%+....') then
jis, uni = line:match ('0x(2[0-9A-D]...).*Windows: U%+(....)')
buf[#buf+1] = {tonumber(uni,16), jis, uni, ' W' }
end
if buf[#buf] and line:match('%[200.%]') then
buf[#buf][5]=true
end
end
tbl:close()
table.sort(buf, function (a,b) return (a[1]<b[1]) end)
for i=1,#buf do
out:write(string.format('%X', tonumber(buf[i][2], 16)) .. ' '
.. buf[i][3] .. buf[i][4]
.. (buf[i][5] and 'N' or '!') .. '\n')
end
out:close()