(defun my-code-char (c)
(if (or (< c 20)
(> c 80))
#\.
(char-code c)))
(defun dump-hex-sequence (seq)
(do ((index 0 (1+ index))
(length (length seq))
(chars (make-string 16 :initial-element #\space)))
((>= index length)
(when (not (= (mod index 16) 0))
(dotimes (i (- 16 (mod index 16)))
(format t " "))
(format t ":~a~%" chars)))
(when (= (mod index 16) 0)
(format t "~6,'0XH: " index))
(format t "~2,'0X " (aref seq index))
(setf (aref chars (mod index 16)) (my-code-char (aref seq index)))
(when (= (mod index 16) 15)
(format t ":~a~%" chars)
(fill chars #\space))))
0 意見:
張貼意見