anchor.diff:  	  (t
   	   code-point))))
   
  -(defun decode-unit-to-bytes (bytes &key (start 0) (end (length bytes))
  -				     (state (make-instance 'scsu-state)))
  -  (declare (type fixnum start end)
  -	   (type (array (unsigned-byte 8) *) bytes))
  -  (let ((current start))
  -    (declare (type fixnum current))
  -    (flet ((pick-byte ()
  -	     (cond ((< current end)
  -		    (prog1 (aref bytes current)
  -		      (incf current)))
  -		   (t
  -		    (error 'scsu-decode-error :format-control "Reached to the end of the bytes")))))
  -      (values (decode-unit* state #'pick-byte) current state))))
  -
   (defun decode-to-string (bytes
   			 &key (src-start 0) (src-end (length bytes))
   			   (string (make-array (floor (length bytes) 2) ; no way to expect length..
  
positive.code: 	   (:single-byte-mode (encode-unit*/single-byte-mode state code-point write-func))
  	   (:unicode-mode (encode-unit*/unicode-mode state code-point write-func))))))
  
  
  ;; The required length is out of BMP case.
  ;; - SQU, <high surrogate 1>, <high surrogate 2>, SQU, <low surrogate 1>, <low surrogate 2>
  
negative.code: 
  (define-condition scsu-decode-error (scsu-error)
    ())
  
  
  ;;; Util
  (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)))))
  
  (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
  