anchor.diff:  (defun query-flags-values (type)
     (%query-enum-or-flags-values #'%flags-class-values '%flags-value type))
   
  -
  -;;;; Named flags types
  -
  -(defmacro define-flags-type (name &rest args)
  -  (let ((flags-int (intern (format nil "~A-TO-INT" name)))
  -	(int-flags (intern (format nil "INT-TO-~A" name))))
  -    `(progn
  -       (deftype ,name () '(flags ,@args))
  -       (defun ,flags-int (value)
  -	 (ecase value
  -	   ,@(%map-enum args :flags-int)))
  -       (defun ,int-flags (value)
  -	 (ecase value
  -	   ,@(%map-enum args :int-flags)))
  -       (defmethod to-alien-form (form (type (eql ',name)) &rest args)
  -	 (declare (ignore type args))
  -	 (list ',flags-int form))
  -       (defmethod from-alien-form (form (type (eql ',name)) &rest args)
  -	 (declare (ignore type args))
  -	 (list ',int-flags form))
  -       (defmethod to-alien-function ((type (eql ',name)) &rest args)
  -	 (declare (ignore type args))
  -	 #',flags-int)
  -       (defmethod from-alien-function ((type (eql ',name)) &rest args)
  -	 (declare (ignore type args))
  -	 #',int-flags)
  -       (defmethod writer-function ((type (eql ',name)) &rest args)
  -	 (declare (ignore type args))
  -	 (let ((writer (writer-function 'signed)))
  -	   #'(lambda (flags location &optional (offset 0))
  -	       (funcall writer (,flags-int flags) location offset))))    
  -       (defmethod reader-function ((type (eql ',name)) &rest args)
  -	 (declare (ignore type args))
  -	 (let ((reader (reader-function 'signed)))
  -	   #'(lambda (location &optional (offset 0))
  -	       (,int-flags (funcall reader location offset))))))))
  -
  -
  -
  -;;;; Type definition by introspection
   
   (defun expand-enum-type (type-number forward-p options)
     (declare (ignore forward-p))
  
positive.code: 	    value)
  	   values)))
        values)))
     
    
  ;;;; Generic enum type
  
  (deftype enum (&rest args)
    `(member ,@(%map-enum args :symbols)))
  
  (defmethod alien-type ((type (eql 'enum)) &rest args)
    (declare (ignore type args))
    (alien-type 'signed))
  
  (defmethod size-of ((type (eql 'enum)) &rest args)
    (declare (ignore type args))
    (size-of 'signed))
  
  (defmethod to-alien-form (form (type (eql 'enum)) &rest args)
    (declare (ignore type))
    `(ecase ,form
      ,@(%map-enum args :enum-int)))
  
  (defmethod from-alien-form (form (type (eql 'enum)) &rest args)
    (declare (ignore type))
    `(ecase ,form
      ,@(%map-enum args :int-enum)))
  
  (defmethod to-alien-function ((type (eql 'enum)) &rest args)
    (let ((mappings (%map-enum args :enum-int)))
      #'(lambda (enum)
  	(or
  	 (second (assoc enum mappings))
  	 (error "~S is not of type ~S" enum (cons type args))))))
  
  (defmethod from-alien-function ((type (eql 'enum)) &rest args)
    (declare (ignore type))
    (let ((mappings (%map-enum args :int-enum)))
      #'(lambda (int)
  	(second (assoc int mappings)))))
  
  (defmethod writer-function ((type (eql 'enum)) &rest args)
    (declare (ignore type))
    (let ((writer (writer-function 'signed))
  	(function (apply #'to-alien-function 'enum args)))
      #'(lambda (enum location &optional (offset 0))
  	(funcall writer (funcall function enum) location offset))))
      
  (defmethod reader-function ((type (eql 'enum)) &rest args)
    (declare (ignore type))
    (let ((reader (reader-function 'signed))
  	(function (apply #'from-alien-function 'enum args)))
      #'(lambda (location &optional (offset 0))
  	(funcall function (funcall reader location offset)))))
  
  
  
  (defclass %enum-value (struct)
  
negative.code: (defun query-enum-values (type)
    (%query-enum-or-flags-values #'%enum-class-values '%enum-value type))
  
  
  (defclass %flags-value (struct)
    ((value :allocation :alien :type unsigned-int)
  