Function: hexl-insert-char

hexl-insert-char is a byte-compiled function defined in hexl.el.gz.

Signature

(hexl-insert-char CH NUM)

Documentation

Insert the character CH NUM times in a hexl buffer.

CH must be a unibyte character whose value is between 0 and 255.

Source Code

;; Defined in /usr/src/emacs/lisp/hexl.el.gz
(defun hexl-insert-char (ch num)
  "Insert the character CH NUM times in a hexl buffer.

CH must be a unibyte character whose value is between 0 and 255."
  (if (or (< ch 0) (> ch 255))
      (error "Invalid character 0x%x -- must be in the range [0..255]" ch))
  (let ((address (hexl-current-address t)))
    (while (> num 0)
      (let ((hex-position (hexl-address-to-marker address))
	    (ascii-position
	     (+ (* (/ address 16) (hexl-line-displen))
                (hexl-ascii-start-column)
                (point-min)
                (% address 16)))
	    at-ascii-position)
	(if (= (point) ascii-position)
	    (setq at-ascii-position t))
	(goto-char hex-position)
	(delete-char 2)
	(insert (format "%02x" ch))
	(goto-char ascii-position)
	(delete-char 1)
	(insert (hexl-printable-character ch))
	(or (= address hexl-max-address)
	    (setq address (1+ address)))
	(hexl-goto-address address)
	(if at-ascii-position
	    (progn
	      (beginning-of-line)
	      (forward-char (hexl-ascii-start-column))
	      (forward-char (% address 16)))))
      (setq num (1- num)))))