概要
引数
c
実装
(defun grass-out-function (c)
(unless (eq (grass-primitive-type c) 'char)
(error "grass-out-function: error: not a character"))
(let ((ch (grass-primitive-value c)))
;; Decode Shift-JIS Encoding Character
(if grass-out-prev-char
(setq ch (condition-case nil
(decode-sjis-char (+ (* grass-out-prev-char 256) ch))
(error (string-to-char "※")))
grass-out-prev-char nil)
(if (and (> ch 127) grass-out-decode-sjis)
(if (or (and (>= ch ?\x81) (<= ch ?\x9f))
(and (>= ch ?\xe0) (<= ch ?\xfc)))
(setq grass-out-prev-char ch)
(setq ch (condition-case nil
(decode-sjis-char ch)
(error (setq grass-out-prev-char ch)))))))
;; Output the Character
(unless grass-out-prev-char
(condition-case nil
(write-char ch)
(error (princ "※")))
;; Update the Screen Intermittently
(unless noninteractive
(let ((outbuf (get-buffer grass-evaluation-buffer-name)))
(when outbuf
(with-current-buffer outbuf
(set-window-point (get-buffer-window outbuf) (point)))
(when (integerp grass-out-update-cycle)
(setq grass-out-counter (1+ grass-out-counter))
(when (or (and (> grass-out-update-cycle 0)
(= grass-out-counter grass-out-update-cycle))
(eq ch 10))
(sit-for 0)
(setq grass-out-counter 0))))))))
c) ;; Return Value
呼出元
履歴
コメント
最終更新:2009年01月05日 01:11