Source of Nothingness - decode

* Menu

[[About:self:AboutPage.txt]] | [[Profile:file/southly/]] | [[まとめ:self:1163859357.txt]] | [[オリジナル:http://ninjinix.x0.com/rn/]] | [[xyzzy:lisp/]] | [[あんてな:listall]] | [[■:lisp]] | [[buzz:files/southly#buzz]]

* 2008-03-23 :

* Common Lisp : 文字列中のエスケープシーケンスを解釈する

とりあえずできた。REPL では動作確認できた。
要 cl-interpol。
SANO さんの情報がなかったらどうにか interpol-reader を使えないか、悩んでいたかも。サンクスです。
[[(ReadMore...) index.rb?1204642645.txt]]

* xyzzy lisp : ミニバッファの入力にエスケープシーケンス

interactive指定子を作っちゃえば楽に置き換えられるんじゃね?
ってことで、こんな。
(in-package "editor")
(defun interactive-read-string-with-escape-sequence (prompt default history title)
  (list (decode-escape-sequence (read-string prompt :default default :history history) nil)))
(pushnew '(#\w . interactive-read-string-with-escape-sequence)
	 *interactive-specifier-alist* :test #'equal)
(defun interactive-read-regexp-with-escape-sequence (prompt default history title)
  (list (decode-escape-sequence (read-string prompt :default default :history history) t)))
(pushnew '(#\W . interactive-read-regexp-with-escape-sequence)
	 *interactive-specifier-alist* :test #'equal)

;; こんな感じで使う
;; 文字列
(defun search-forward-wes (pattern &optional noerror)
  (interactive "wSearch forward: "
    :default0 *last-search-string* :history0 'search)
  (search-command pattern nil nil (interactive-p) noerror))
;; 正規表現
(defun re-search-forward-wes (regexp &optional noerror)
  (interactive "WRe-search forward: "
    :default0 *last-search-regexp* :history0 'search)
  (search-command regexp nil t (interactive-p) noerror))
(export '(search-forward-wes re-search-forward-wes))
(in-package "user")

* editorパッケージのbuiltin関数

以下で調べて652個
(let ((count 0))
  (do-symbols (sym (find-package "editor") (format t "~%count: ~d~%" count))
    (when (and (not (find-symbol (symbol-name sym) "lisp"))
               (fboundp sym)
               (si:*builtin-function-p (symbol-function sym)))
      (format t "~a~%" sym)
      (incf count))))
[[(ReadMore...) index.rb?1164371462.txt]]

* clispcgi

URIのデコード・エンコードが一応完成。
感想メモ
・whileが無くてびっくり
xyzzy lispとの微妙な差が気になる
・(alphanumericp #\あ) => T ってなんだよ!?

[[(ReadMore...) index.rb?1141223408.txt]]

* clispcgi

必須のurl-encode&url-decodeの方法を探す。
clispの場合、このあたりが使えそう。

(format nil "~{~A~}"
        (map 'list
             #'(lambda (x)
                 (format nil "%~2,'0x" x))
             (ext:convert-string-to-bytes "あかさたな" charset:utf-8)))
=>"%E3%81%82%E3%81%8B%E3%81%95%E3%81%9F%E3%81%AA"

よしよしっと。
デコードは大変だな。
違う文字コードでエンコードされてやってきたらどうしたらいいんだろ。

[[(ReadMore...) index.rb?1141052899.txt]]