diff -rN -u old-cffi/grovel/grovel.lisp new-cffi/grovel/grovel.lisp
--- old-cffi/grovel/grovel.lisp	2010-04-29 12:32:26.893132980 +0800
+++ new-cffi/grovel/grovel.lisp	2010-04-29 12:32:27.577135220 +0800
@@ -627,6 +627,32 @@
        'constant out
        `((,(intern (string lisp-name)) ,(car c-names))
          ,@options)))))
+
+(define-grovel-syntax bitfield (name-and-opts &rest masks)
+  "Defines a bitfield, with elements specified as ((lisp-name c-name)
+&key documentation). name-and-opts can be either a symbol as name, or
+a list (name &key base-type)."
+  (destructuring-bind (name &key base-type)
+      (ensure-list name-and-opts)
+    (c-section-header out "bitfield" name)
+    (c-export out name)
+    (c-format out "(cffi:defbitfield (")
+    (c-print-symbol out name t)
+    (when base-type
+      (c-printf out " ")
+      (c-print-symbol out base-type t))
+    (c-format out ")")
+    (dolist (mask masks)
+      (destructuring-bind ((lisp-name c-name) &key documentation) mask
+        (declare (ignore documentation))
+        (check-type lisp-name symbol)
+        (check-type c-name string)
+        (c-format out "~%  (")
+        (c-print-symbol out lisp-name)
+        (c-format out " ")
+        (c-printf out "%i" c-name)
+        (c-format out ")")))
+    (c-format out ")~%")))
 
 
 ;;;# Wrapper Generation
