外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
clispでスケールを取得する(hs)
:clispでスケールを取得する(hs)
@echo off
for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
more +%%n %0 | clisp -q > nul
)
goto:eof
REM #jww
REM #e
#!この次の行からプログラムを書いてください
( ;文字列 "x" を 整数に変換
defun to_i (x)
(if (numberp x)
(* (signum x) (floor (abs x)))
(progn
(if (equal x nil) (setq x "0"))
(if (listp x)
(mapcar #'to_i x)
(progn
(if (stringp x) nil (setq x (write-to-string x)))
(parse-integer x)
)
)
)
)
)
( ;16進数のレイヤ番号を10進数に変換する
defun hex (x)
(cond
( (regexp:match "^[0-9]$" x) (parse-integer x))
( (equal x (or "a" "A")) 10)
( (equal x (or "b" "B")) 11)
( (equal x (or "c" "C")) 12)
( (equal x (or "d" "D")) 13)
( (equal x (or "e" "E")) 14)
( (equal x (or "f" "F")) 15)
)
)
(defun hs (&optional x) ;レイヤグループのスケール(縮尺の逆数)を返す
(unless x (setq x (if lg lg 0)))
(nth (hex x) hs)
)
;本文
(setq olg nil)
( ;jwc_temp.txt から 入力
with-open-file (f "jwc_temp.txt" :direction :input)
(loop for line = (read-line f nil) while line do
(setq a (regexp:regexp-split "\\s\\+" line))
(if (regexp:match "^hs" line) (setq hs (cdr a)))
(if (regexp:match "^lg" line)
(progn
(setq plg (subseq line 2 3))
(if (equal olg nil) (setq olg plg))
)
)
)
)
( ;jwc_temp.txt へ 出力
with-open-file (f "jwc_temp.txt" :direction :output)
; (format f "h#S=1/~a~%" (nth (hex olg) hs))
(format f "h#S=1/~a~%" (hs olg))
)
(hs 0) あるいは (hs "0")、(hs 10) あるいは (hs "a") でスケールの逆数を返します。