Changeset 14435


Ignore:
Timestamp:
Nov 18, 2010, 10:07:49 PM (9 years ago)
Author:
gb
Message:

Treat some intrinsic types (LONG-FLOAT, etc.) as if they were small
foreign arrays. This isn't quite right - alignment constraints may
differ and this doesn't really define those types in a usable way,
but hopefully this fixes ticket:781.

Even though the structures FFI-STRUCT and FFI-UNION intentionally
have the same layout, assuming this might lead to street crime, as
some unsolicited typechecking helpfully pointed out ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lib/db-io.lisp

    r13067 r14435  
    13221322           (:signed `(,encoded-type-signed-32))
    13231323           (:unsigned `(,encoded-type-unsigned-32))
    1324            ((:long-double :complex-int
    1325                         :complex-float :complex-double :complex-long-double)
    1326             (encode-ffi-type `(:struct ,primtype))))
     1324           ((:long-float :long-double) (encode-ffi-type '(:array 2 (:primitive :double))))
     1325           (:complex-int (encode-ffi-type '(:array 2 (:primitive :signed))))
     1326           (:complex-float (encode-ffi-type '(:array 2 (:primitive :float))))
     1327           (:complex-double (encode-ffi-type '(:array 2 (:primitive :double))))
     1328           (:complex-long-double (encode-ffi-type '(:array 4 (:primitive :double)))))
    13271329         (ecase (car primtype)
    13281330           (* `(,encoded-type-pointer ,@(encode-ffi-type
     
    13961398           (:unsigned `(f))
    13971399           ((:long-double :complex-int
    1398                           :complex-float :complex-double :complex-long-double)           
     1400                          :complex-float :complex-double :complex-long-double)
    13991401            #|(encode-ffi-arg-type `(:struct ,primtype))|#
    14001402            `(#\?)))
     
    14281430          (:union #\u)
    14291431          (:transparent-union #\U))
    1430            ,@(encode-name (ffi-struct-reference (cadr spec)))))
     1432           ,@(encode-name
     1433              (if (eq (car spec) :struct)
     1434                (ffi-struct-reference (cadr spec))
     1435                (ffi-union-reference (cadr spec))))))
    14311436    (:typedef
    14321437     `(#\t ,@(encode-name (ffi-typedef-name (cadr spec)))))
Note: See TracChangeset for help on using the changeset viewer.