anchor.diff:  ;;; Util
   (defmacro with-scsu-error-handling
       ((state &key src dst return) &body body)
  -  (alexandria:with-gensyms (state_ m_ d-w_ a-w-i_ src_ dst_)
  -    `(let* ((,state_ ,state)
  -	    (,m_ (slot-value ,state_ 'mode))
  -	    (,d-w_ (slot-value ,state_ 'dynamic-window))
  -	    (,a-w-i_ (slot-value ,state_ 'active-window-index))
  -	    (,src_ ,src) (,dst_ ,dst))	; Holds a restartable state.
  +  (alexandria:with-gensyms (%state %m %d-w %a-w-i %src %dst)
  +    `(let* ((,%state ,state)
  +	    (,%m (slot-value ,%state 'mode))
  +	    (,%d-w (slot-value ,%state 'dynamic-window))
  +	    (,%a-w-i (slot-value ,%state 'active-window-index))
  +	    (,%src ,src) (,%dst ,dst))	; Holds a restartable state.
          (restart-case
   	   (handler-bind ((scsu-error
   			   (lambda (c)
  
positive.code: 	     (progn ,@body))
  	 (restore-state ()
  	   :report "Restore SCSU state to a restartable previous state, and return"
  	   (setf (slot-value ,state_ 'mode) ,m_
  		 (slot-value ,state_ 'dynamic-window) ,d-w_
  		 (slot-value ,state_ 'active-window-index) ,a-w-i_)
  	   (funcall ,return ,dst_ ,src_))))))
  
  (defmacro with-reading-function ((function current)
  				 (buffer start end &key (element-type '(unsigned-byte 8)))
  				 &body body)
    (alexandria:once-only (buffer start end)
      `(locally (declare (type fixnum ,start ,end)
  		       (type (array ,element-type (*)) ,buffer))
         (let ((,current ,start))
  	 (declare (type fixnum ,current))
  	 (flet ((,function ()
  		  (cond ((< ,current ,end)
  			 (prog1 (aref ,buffer ,current)
  			   (incf ,current)))
  			(t
  			 (error 'scsu-error :format-control "Reached to the end of the buffer")))))
  	   ,@body)))))
  
  ;; TODO: merge with above
  (defmacro with-writing-function ((function current)
  				 (buffer start end &key (element-type '(unsigned-byte 8)))
  				 &body body)
    (alexandria:once-only (buffer start end)
      `(locally (declare (type fixnum ,start ,end)
  		       (type (array ,element-type (*)) ,buffer))
         (let ((,current ,start))
  	 (declare (type fixnum ,current))
  	 (flet ((,function (c)
  		  (cond ((< ,current ,end)
  			 (setf (aref ,buffer ,current) c)
  			 (incf ,current))
  			((array-has-fill-pointer-p ,buffer)
  			 (vector-push-extend c ,buffer) ; TODO: wrap error from outer.
  			 (incf ,current))
  			(t
  			 (error 'scsu-error :format-control "Reached to the end of the string")))))
  	   ,@body)))))
  
  
  ;;; Decoder
  
negative.code: 	 (ret-string (first ret-list)))
      (declare (type list ret-list)
  	     (type string ret-string))	     
      (apply #'values (char ret-string 0) (rest ret-list)))) ; TODO: use a error handler, if no char decoded.
  
  
  ;;; Encode
  