2009/06/26

いまさらだけど Clozure CL は Windows でもスレッドが使える

Clozure CL(CCL)なの。いや、以前からそんな話はきいてたんだけど何故かあまり気にしていなかった。いまさらながら、いじってみると確かにスレッドが使える。 Hunchentoot もすんなり動いた。これで簡単に Windows 上で Web サーバがたてられるw

あとは CP932 だけですね♪

おさらいをかねて初期化ファイルを。 c:/Users/ancient/ccl-init.lisp

;;;; -*- lisp -*-

;;; 最適化
#+nil
(declaim (optimize (debug 3) (safety 3) (speed 0) (space 0)
(compilation-speed 3)))

#+nil
(declaim (optimize (debug 0) (safety 0) (speed 3) (space 0)
(compilation-speed 0)))



;;; 文字コード
(setf ccl:*default-external-format*
(ccl:make-external-format :character-encoding :utf-8
:line-termination :dos)
ccl:*default-file-character-encoding* :utf-8
ccl:*default-socket-character-encoding* :utf-8)


;;; asdf
(require :asdf)

;; ~/letter/lib 以下の asd を登録する。
(loop for path in (directory (translate-logical-pathname
"home:letter;lisp;lib;**;*.asd"))
do (let ((pd (pathname-directory path)))
(unless (member "_darcs" pd :test #'equal)
(pushnew (make-pathname :directory pd)
asdf:*central-registry*
:test #'equal))))

;; clbuild
;;(pushnew (translate-logical-pathname "home:letter;lisp;clbuild;systems;")
;; asdf:*central-registry*)
;; ~/letter/lib 以下の asd を登録する。
(loop for path in (directory (translate-logical-pathname
"home:letter;lisp;clbuild;source;**;*.asd"))
do (let ((pd (pathname-directory path)))
(unless (member "_darcs" pd :test #'equal)
(pushnew (make-pathname :directory pd)
asdf:*central-registry*
:test #'equal))))


;; require で asdf:oos する
(defun asdf-module-provider-function (module)
(when (asdf:find-system module nil)
(asdf:oos 'asdf:load-op module)
t))
(pushnew 'asdf-module-provider-function
ccl::*module-provider-functions*)

(defmethod asdf:perform :around ((o asdf:load-op) (c asdf:cl-source-file))
(handler-case (call-next-method o c)
(#+sbcl sb-ext:invalid-fasl
#+allegro excl::file-incompatible-fasl-error
#+lispworks conditions:fasl-error
#+cmu ext:invalid-fasl
#-(or sbcl allegro lispworks cmu) error ()
(asdf:perform (make-instance 'asdf:compile-op) c)
(call-next-method))))

Clozure CL 本体の他に、clbuid が使いたいので cygwin とか darcs とか git とか svn とかも必要。

./clbuild install hunchentoot

して、

CL-USER> (require :hunchentoot)
CL-USER> (hunchentoot:start (make-instance 'hunchentoot:acceptor :port 1234))

http://localhost:1234/ にアクセス♪

もちろん Meadow と

./clbuild install slime

も必要。ついでに ~/.emacs の SLIME まわりの設定。

(require 'path-util) ; add-path用

(add-path "~/letter/lisp/clbuild/source/slime")
(add-path "~/letter/lisp/clbuild/source/slime/contrib")
(setq slime-lisp-implementations
`((ccl ("/Users/ancient/local/opt/ccl/wx86cl.exe")
:coding-system utf-8-unix)
(sbcl ("sbcl")
:coding-system utf-8-unix)
(clisp ("clisp") :coding-system utf-8-unix)))
(require 'slime-autoloads)
(add-hook 'lisp-mode-hook
(lambda ()
(cond ((not (featurep 'slime))
(require 'slime)
(normal-mode)))))
(setq slime-truncate-lines nil)
(setq slime-enable-evaluate-in-emacs t)
(add-hook
'slime-mode-hook
(lambda ()
(global-set-key [(control ?\;)] 'slime-selector)
(loop for (key command) in
'(("\C-m" newline-and-indent)
("\C-i" slime-indent-and-complete-symbol))
do (define-key slime-mode-map key command))))
(add-to-list 'auto-mode-alist '("\\.asd$" . common-lisp-mode))
(eval-after-load "slime"
'(progn
(slime-setup '(slime-repl slime-asdf slime-fancy slime-banner))
(setq slime-complete-symbol*-fancy t)
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)))

0 件のコメント: