外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。
clispで文字寸法を取得する(hcw,hch,hcd,hcc)
:clispで文字寸法を取得する(hcw,hch,hcd,hcc)
@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)
)
)
)
)
)
(defun hcw (&optional x) (nth (to_i x) hcw))
(defun hch (&optional x) (nth (to_i x) hch))
(defun hcd (&optional x) (nth (to_i x) hcd))
(defun hcc (&optional x) (nth (to_i x) hcc))
(setq cn 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 "^hcw" line) (setq hcw a))
(if (regexp:match "^hch" line) (setq hch a))
(if (regexp:match "^hcd" line) (setq hcd a))
(if (regexp:match "^hcc" line) (setq hcc a))
(if (regexp:match "^cn[0-9]" line)
(progn
(setq pcn (subseq line 2))
(if (equal cn nil)
(progn
(setq cn pcn)
(setq n (length cn))
(if (< n 3)
(progn
(setq cw (hcw cn))
(setq ch (hch cn))
(setq cd (hcd cn))
(setq cc (hcc cn))
);then
(progn
(setq b (regexp:regexp-split "\\s\\+" cn))
(setq cn (nth 0 b))
(setq cw (nth 1 b))
(setq ch (nth 2 b))
(setq cd (nth 3 b))
(setq cc (nth 4 b))
);else
);if
);then
);if
);then
);if
)
)
( ;jwc_temp.txt へ 出力
with-open-file (f "jwc_temp.txt" :direction :output)
(format f "h#cn~a ~f ~f ~f ~a~%" cn cw ch cd cc)
)