Fix parsing ccl:describe-character-encodings.

First, despite the documentation mentionning the function writes
to *terminal-io*, in fact it's doing (format t ...) and thus the result
is written to *standard-output*.

Second, CCL has encodings with no aliases.
This commit is contained in:
Dimitri Fontaine 2014-04-29 14:25:40 +02:00
parent 0c371797dc
commit f5f584fdf1

View File

@ -208,10 +208,12 @@ in 2 bytes.
(defun parse-ccl-encodings-desc-first-line (line) (defun parse-ccl-encodings-desc-first-line (line)
"Given a line with :ENCODING [Aliases: :X :Y] return a proper cons." "Given a line with :ENCODING [Aliases: :X :Y] return a proper cons."
(cl-ppcre:register-groups-bind (name aliases) (or (cl-ppcre:register-groups-bind (name aliases)
(":([A-Z0-9-]+).*Aliases: (.*)[]]" line) (":([A-Z0-9-]+).*Aliases: (.*)[]]" line)
(cons name (mapcar (lambda (alias) (subseq alias 1)) (cons name (mapcar (lambda (alias) (subseq alias 1))
(split-sequence:split-sequence #\Space aliases))))) (split-sequence:split-sequence #\Space aliases))))
;; some of them have no alias
(cons (subseq line 1) nil)))
(defun parse-ccl-encodings-desc (&optional (defun parse-ccl-encodings-desc (&optional
(desc *ccl-describe-character-encodings*)) (desc *ccl-describe-character-encodings*))
@ -228,7 +230,7 @@ in 2 bytes.
of them." of them."
(let ((encoding-and-aliases (let ((encoding-and-aliases
#+ccl #+ccl
(parse-ccl-encoding-desc (with-output-to-string (*terminal-io*) (parse-ccl-encodings-desc (with-output-to-string (*standard-output*)
(ccl:describe-character-encodings))) (ccl:describe-character-encodings)))
#+sbcl #+sbcl
(let ((result '())) (let ((result '()))