anchor.diff:                            (loop for i below pad
                                do (write-value type out 0))))))))
   
  +
  +(defgeneric bytes-per-entry (class))
  +(defgeneric entry-bytes (ifd-entry))
  +
  +(defmethod entry-bytes ((entry ifd-entry))
  +  (* (value-count entry)
  +     (bytes-per-entry (class-of entry))))
  +
   ;; 1 - byte
   (define-binary-class byte-ifd-entry (ifd-entry)
     ((data (ifd-array :type 'u1 :size value-count))))
  +(defmethod bytes-per-entry ((class (eql (find-class 'byte-ifd-entry)))) 1)
   
   ;; 2 - ascii
   (define-binary-class ascii-ifd-entry (ifd-entry)
     ((data (ifd-array :type 'iso-8859-1-char :size value-count :element-type 'character))))
  +(defmethod bytes-per-entry ((class (eql (find-class 'ascii-ifd-entry)))) 1)
   
   ;; 3 -- short
   (define-binary-class short-ifd-entry (ifd-entry)
     ((data (ifd-array :type 'u2* :size value-count))))
  +(defmethod bytes-per-entry ((class (eql (find-class 'short-ifd-entry)))) 2)
   
   ;; 4 -- long
   (define-binary-class long-ifd-entry (ifd-entry)
     ((data (ifd-array :type 'u4* :size value-count))))
  +(defmethod bytes-per-entry ((class (eql (find-class 'long-ifd-entry)))) 4)
   
   ;; 5 -- rational
   (define-binary-class rational ()
  
positive.code:                    :data data
                     :value-count (length data))))
  
  (defun make-ifd-entry-short (tag data)
    (let ((data (vectorize data)))
      (make-instance 'short-ifd-entry
                     :tag tag
                     :field-type +field-type-short+
                     :data data
                     :value-count (length data))))
  
  ;; we should return the number of strips (and possibly the length of
  ;; each strip (uncompressed), but not yet)..
  
negative.code:            (add-ifd-entry 
              ifd
              (make-ifd-entry-short +photometric-interpretation-tag+
                                    +photometric-interpretation-rgb+))))
  
          (add-ifd-entry ifd
                         (make-ifd-entry-long +rows-per-strip-tag+ rows-per-strip))
          (add-ifd-entry ifd
                         (make-ifd-entry-long +strip-byte-counts-tag+ strip-byte-counts))
          
          (setf (ifd-list fields) (list ifd))
  
          (incf *tiff-file-offset* 8)
          (setf (ifd-offset fields) *tiff-file-offset*)
          
          (let ((num-entries (print (entry-count ifd))))
            (incf *tiff-file-offset* (+ 2 (* num-entries 12))))
          
          (let ((out-of-line-data-size 
                 (* 4 (length strip-offsets))))
            (loop for entry in (entries ifd)
               do (describe entry) 
                 (incf out-of-line-data-size 
                       (ifd-entry-out-of-line-bytes entry)))
          
            ;; skip one more ifd-entry
            (incf *tiff-file-offset* 12)
            (incf *tiff-file-offset* 4)
                      
            ;; *file-offset* to the strip-offsets
            (add-ifd-entry
             ifd
             (make-ifd-entry-long
              +strip-offsets-tag+
              (print (map 'vector
                          (lambda (x) (+ x
                                         *tiff-file-offset*
                                         out-of-line-data-size))
                          strip-offsets))))
  
            (values fields out-of-line-data-size strip-offsets strip-byte-counts))))))
  
  ;;;
  ;;; The general strategy here is to:
  