jw_cad 外部変形 - (1095) clispで文字を逆書きする -

外部変形は データのやり取りをテキストファイルで行うので プログラム言語は 自由に選ぶことができます。図形は機能的かつシンプルなため、数多くのユーザーに受け入れられています。

 

clispで文字を逆書きする

:clispで文字を逆書きする
@echo off
for /f "delims=:" %%n in ('findstr /n "^#!" %0') do (
  more +%%n %0 | clisp -q > nul
)
goto:eof

REM #jww
REM #h3 範囲内の「文字」データのみを選択
REM #g1
REM #e

#!この次の行からプログラムを書いてください
( ;jwc_temp.txt へ 出力
  with-open-file (g "jwc_temp.bak" :direction :output)
( ;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 "^hq" line)
        (progn
          (write-line "hd" g)
        )
    )
    (if (regexp:match "^\\(lg\\|ly\\|cn\\)" line)
        (progn
          (write-line line g)
        )
    )
    (if (regexp:match "^ch" line)
        (progn
          (setq s (search "\"" line))
          (setq str (subseq line (+ s 1) (length line)))
          (format g "~{~a ~} \"~a~%" (subseq a 0 5) (reverse str))
        )
    )
  )
)
)
(delete-file "jwc_temp.txt")
(rename-file "jwc_temp.bak" "jwc_temp.txt")

 

 

clisp は日本語の扱いが若干苦手なようです。この例題では半角文字が先頭にあればなんとかなります。