Sunday, August 12, 2007

OpenMCL part in emacs-init.lisp


(setf u:*ccl-home* (concat u:*home* "Library/CCL/"))
(setf u:*ccl-init* (concat u:*openmcl-home* "ccl-init.lisp"))
(setf u:*ccl-exec* (concat u:*openmcl-home* "ccl/dppccl"))
(setenv "CCL_DEFAULT_DIRECTORY" (concat u:*ccl-home* "ccl"))

(defmacro def-slime-lisp (lisp)
`(defun ,lisp ()
(interactive)
(let ((slime-default-lisp '`,lisp)) (slime))))

(def-slime-lisp sbcl)
(def-slime-lisp ccl)

(slime)))

Wednesday, August 8, 2007

KMP Languages Mapper


(defvar *kmp-info* nil)

(defun read-kmp-info (path)
(let ((info '()))
(with-open-file (s path :direction :INPUT)
(do*
((line #1=(read-line s nil) #1#)
(wrds #2=(cl-ppcre:split "\\t" line) #2#)
(key #3=(nth 0 wrds) #3#))

((not (and key line)) (reverse info)) ;; RETURN POINT

(push
(cons (nth 0 wrds)
(list
:LOUT-ID (nth 1 wrds)
:LOUT-NAME (nth 2 wrds)
:LOUT-TBL (nth 3 wrds)
:LOUT-TBL-FLGS (nth 4 wrds)
:LOUT-ATBL (nth 5 wrds)
:LOUT-ATBL-FLGS (nth 6 wrds)
:LOUT-NUMPAD (nth 7 wrds)
:LOUT-ACCENTS (nth 8 wrds)

:LOUT-INTL (let ((val (nth 9 wrds))) (and val (/= 0 (length val))))
:LOUT-LATIN (let ((val (nth 10 wrds))) (and val (/= 0 (length val))))))
info))
)))

;;;(pop *kmp-info*)
(progn
(setf *kmp-info* (read-kmp-info #p"src:kmp_util;KeyMapperLanguages.txt"))


(with-open-file (os #p"src:kmp_util;KeyMapperLanguages.lisp"
:direction :OUTPUT
:if-exists :SUPERSEDE
:if-does-not-exist :CREATE)
(pprint *kmp-info* os)))