どう書く?org ウインドウの表示 を common lispで
久しぶりにどう書く.orgの続き。
僕が先に進よりお題が先に追加されてて永遠に追い付けないような気がしてきた。
GUI表示ってどうやればいいの?というところからわからないので、「Common lisp GUI」で検索。
一番最初に見付かった日本語サイトにLTKって書いてあるからこれでいく。googleで上位にきてんだから問題ないだろ。たぶん。
asdf-installで入れて、サンプルを見ながら表示。
これだけならすごく簡単。
最初はtclもtkも入ってなくて「no such program: "wish"」って怒られたけど。
日本語の表示でハマるんじゃないか、と思ったけど、slimeから動かした限りでは正常に表示できてる。
; SLIME 2006-11-26 CL-USER> (require :asdf) NIL CL-USER> (require :asdf-install) ("ASDF-INSTALL") CL-USER> (asdf-install:install :ltk) Install where? 1) System-wide install: System in /usr/lib/sbcl/site-systems/ Files in /usr/lib/sbcl/site/ 2) Personal installation: System in /home/satoshi/.sbcl/systems/ Files in /home/satoshi/.sbcl/site/ --> 1 (asdf:operate 'asdf:load-op :ltk :verbose nil) (use-package :ltk) (with-ltk () (wm-title *tk* "こんにちは、GUI") (minsize *tk* 400 300) (maxsize *tk* 400 300) t)
コンパイルしても大丈夫かな・・・。
心配なのでやってみた。
; SLIME 2006-11-26 STYLE-WARNING: implicitly creating new generic function CALC-SCROLL-REGION CL-USER> (require :sb-executable) ("SB-EXECUTABLE") CL-USER> (compile-file "window.lisp") ; compiling file "/home/satoshi/window.lisp" (written 15 SEP 2007 08:42:10 PM): ; compiling (ASDF:OPERATE (QUOTE ASDF:LOAD-OP) ...) ; compiling (USE-PACKAGE :LTK) ; compiling (WITH-LTK NIL ...) ; /home/satoshi/window.fasl written ; compilation finished in 0:00:00 #P"/home/satoshi/window.fasl" NIL NIL CL-USER> (sb-executable:make-executable "ltk-window" "window.fasl") T 0
こんな感じでコンパイルして、
./ltk-window
ちゃんと表示できた。