外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
luaで指示文字を確認する(ch)
:luaで指示文字を確認する(ch)
@echo off
for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
copy jwc_temp.txt myfiles > nul
more +%%n %0 | lua - myfiles > jwc_temp.txt
)
goto:eof
REM #jww
REM #1%dch 文字を指示してください
REM #99#
REM #bz
REM #e
#!この次の行からプログラムを書いてください
hp = {}; ch = {}
for line in io.lines(arg[1]) do
F = {}
line:gsub("%S+", function (x) table.insert(F, x) end)
if line:match("^hq") then
print("bz")
end
if line:match("^hp([1-9][0-9]?)ch") then
hp[line:match("^hp([1-9][0-9]?)")*1] = {F[2]*1, F[3]*1}
end
if line:match("^hhp([1-9][0-9]?)ch") then
i = line:match("^hhp([1-9][0-9]?)ch")*1
end
if line:match("^c[hvsroptkz2]") and line:find("\"") then
j = line:find("\"")
str = line:sub(j + 1)
ch[i] = {F[1], F[2]*1, F[3]*1, F[4]*1, F[5]*1, str}
end
end
chn = #ch
for i = 1, chn do
c, x1, y1, lx, ly = unpack(ch[i])
l = math.sqrt(lx * lx + ly * ly)
d = math.atan2(ly, lx)
x2 = x1 + l * math.cos(d)
y2 = y1 + l * math.sin(d)
print( ("%s %s %s %s"):format(x1, y1, x2, y2))
x, y = unpack(hp[i])
print( ("ci %s %s 1"):format(x, y))
end
指示した文字に下線を引き、指示点に半径1mmの円を記入しています。