0.7.1.18:
[sbcl.git] / src / code / host-alieneval.lisp
index 7d52587..0a263e1 100644 (file)
           (create-alien-type-class-if-necessary ',name ',(or include 'root)))
         (def!struct (,defstruct-name
                        (:include ,include-defstruct
-                                 (:class ',name)
+                                 (class ',name)
                                  ,@overrides)
                        (:constructor
                         ,(symbolicate "MAKE-" defstruct-name)
 \f
 ;;;; the ENUM type
 
-(define-alien-type-class (enum :include (integer (:bits 32))
+(define-alien-type-class (enum :include (integer (bits 32))
                               :include-args (signed))
   name         ; name of this enum (if any)
   from         ; alist from keywords to integers.
        (t
        (make-alien-enum-type :name name :signed signed
                              :from from-alist
-                             :to (mapcar #'(lambda (x) (cons (cdr x) (car x)))
+                             :to (mapcar (lambda (x) (cons (cdr x) (car x)))
                                          from-alist)
                              :kind :alist))))))
 
 (define-alien-type-method (enum :unparse) (type)
   `(enum ,(alien-enum-type-name type)
         ,@(let ((prev -1))
-            (mapcar #'(lambda (mapping)
-                        (let ((sym (car mapping))
-                              (value (cdr mapping)))
-                          (prog1
-                              (if (= (1+ prev) value)
-                                  sym
-                                  `(,sym ,value))
-                            (setf prev value))))
+            (mapcar (lambda (mapping)
+                      (let ((sym (car mapping))
+                            (value (cdr mapping)))
+                        (prog1
+                            (if (= (1+ prev) value)
+                                sym
+                                `(,sym ,value))
+                          (setf prev value))))
                     (alien-enum-type-from type)))))
 
 (define-alien-type-method (enum :type=) (type1 type2)
             (+ ,alien ,(alien-enum-type-offset type))))
     (:alist
      `(ecase ,alien
-       ,@(mapcar #'(lambda (mapping)
-                     `(,(car mapping) ,(cdr mapping)))
+       ,@(mapcar (lambda (mapping)
+                   `(,(car mapping) ,(cdr mapping)))
                  (alien-enum-type-to type))))))
 
 (define-alien-type-method (enum :deport-gen) (type value)
   `(ecase ,value
-     ,@(mapcar #'(lambda (mapping)
-                  `(,(car mapping) ,(cdr mapping)))
+     ,@(mapcar (lambda (mapping)
+                `(,(car mapping) ,(cdr mapping)))
               (alien-enum-type-from type))))
 \f
 ;;;; the FLOAT types
   (declare (ignore type))
   value)
 
-(define-alien-type-class (single-float :include (float (:bits 32))
+(define-alien-type-class (single-float :include (float (bits 32))
                                       :include-args (type)))
 
 (define-alien-type-translator single-float ()
   (declare (ignore type))
   `(sap-ref-single ,sap (/ ,offset sb!vm:n-byte-bits)))
 
-(define-alien-type-class (double-float :include (float (:bits 64))
+(define-alien-type-class (double-float :include (float (bits 64))
                                       :include-args (type)))
 
 (define-alien-type-translator double-float ()
   `(sap-ref-double ,sap (/ ,offset sb!vm:n-byte-bits)))
 
 #!+long-float
-(define-alien-type-class (long-float :include (float (:bits #!+x86 96
+(define-alien-type-class (long-float :include (float (bits #!+x86 96
                                                            #!+sparc 128))
                                     :include-args (type)))
 
 \f
 ;;;; the POINTER type
 
-(define-alien-type-class (pointer :include (alien-value (:bits
+(define-alien-type-class (pointer :include (alien-value (bits
                                                         #!-alpha
                                                         sb!vm:n-word-bits
                                                         #!+alpha 64)))
     (unless (typep (first dims) '(or index null))
       (error "The first dimension is not a non-negative fixnum or NIL: ~S"
             (first dims)))
-    (let ((loser (find-if-not #'(lambda (x) (typep x 'index))
+    (let ((loser (find-if-not (lambda (x) (typep x 'index))
                              (rest dims))))
       (when loser
        (error "A dimension is not a non-negative fixnum: ~S" loser))))
     ,(alien-record-type-name type)
     ,@(unless (member type *record-types-already-unparsed* :test #'eq)
        (push type *record-types-already-unparsed*)
-       (mapcar #'(lambda (field)
-                   `(,(alien-record-field-name field)
-                     ,(%unparse-alien-type (alien-record-field-type field))
-                     ,@(if (alien-record-field-bits field)
-                           (list (alien-record-field-bits field)))))
+       (mapcar (lambda (field)
+                 `(,(alien-record-field-name field)
+                   ,(%unparse-alien-type (alien-record-field-type field))
+                   ,@(if (alien-record-field-bits field)
+                         (list (alien-record-field-bits field)))))
                (alien-record-type-fields type)))))
 
 ;;; Test the record fields. The depth is limiting in case of cyclic
 \f
 ;;;; the FUNCTION and VALUES alien types
 
+;;; not documented in CMU CL:-(
+;;;
+;;; reverse engineering observations:
+;;;   * seems to be set when translating return values
+;;;   * seems to enable the translation of (VALUES), which is the
+;;;     Lisp idiom for C's return type "void" (which is likely
+;;;     why it's set when when translating return values)
 (defvar *values-type-okay* nil)
 
 (define-alien-type-class (fun :include mem-block)
   (stub nil :type (or null function)))
 
 (define-alien-type-translator function (result-type &rest arg-types
-                                                &environment env)
+                                                   &environment env)
   (make-alien-fun-type
    :result-type (let ((*values-type-okay* t))
                  (parse-alien-type result-type env))