Changeset 403
- Timestamp:
- Jan 25, 2004, 2:14:24 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/lib/foreign-types.lisp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/lib/foreign-types.lisp
r385 r403 58 58 (attributes #+darwinppc-target '(:signed-char :struct-by-value :prepend-underscores) 59 59 #+linuxppc-target ()) 60 (ordinal->type (make-array 100 :fill-pointer 0)))60 (ordinal->type (make-array 100 :fill-pointer 1))) 61 61 62 62 (defvar *host-ftd* (make-ftd)) … … 288 288 (class 'root :type symbol) 289 289 (bits nil :type (or null unsigned-byte)) 290 (alignment (guess-alignment bits) :type (or null unsigned-byte))) 290 (alignment (guess-alignment bits) :type (or null unsigned-byte)) 291 (assigned-ordinal nil)) 292 293 (defun foreign-type-ordinal (ftype) 294 (or (foreign-type-assigned-ordinal ftype) 295 (setf (foreign-type-assigned-ordinal ftype) 296 (vector-push-extend ftype (ftd-ordinal->type *target-ftd*))))) 297 298 (defun ordinal-to-foreign-type (ordinal &optional (ftd *target-ftd*)) 299 (elt (ftd-ordinal->type ftd) ordinal)) 300 291 301 292 302 (defmethod make-load-form ((s foreign-type) &optional env) 293 303 (make-load-form-saving-slots s :environment env)) 304 294 305 295 306 … … 623 634 (make-foreign-integer-type :bits bits))) 624 635 636 637 625 638 (def-foreign-type-translator integer (&optional (bits 32)) 626 639 (if (<= bits 32) … … 634 647 635 648 (def-foreign-type-method (integer :unparse) (type) 636 (list (if (foreign-integer-type-signed type) 'signed 'unsigned)649 (list (if (foreign-integer-type-signed type) :signed :unsigned) 637 650 (foreign-integer-type-bits type))) 638 651 … … 855 868 ;;;; The MEM-BLOCK type. 856 869 870 857 871 (def-foreign-type-class (mem-block :include foreign-value)) 858 872 859 873 (def-foreign-type-method (mem-block :extract-gen) (type sap offset) 860 ( declare (ignore type))861 `(%inc-ptr ,sap (/ ,offset 8)))874 (let* ((nbytes (%foreign-type-or-record-size type :bytes))) 875 `(%composite-pointer-ref ,nbytes ,sap (/ ,offset 8)))) 862 876 863 877 (def-foreign-type-method (mem-block :deposit-gen) (type sap offset value) … … 1298 1312 1299 1313 (defun %foreign-type-or-record (type) 1300 (if (consp type) 1301 (parse-foreign-type type) 1302 (or (%find-foreign-record type) 1303 (parse-foreign-type type)))) 1314 (if (typep type 'foreign-type) 1315 type 1316 (if (consp type) 1317 (parse-foreign-type type) 1318 (or (%find-foreign-record type) 1319 (parse-foreign-type type))))) 1304 1320 1305 1321 (defun %foreign-type-or-record-size (type &optional (units :bits)) … … 1617 1633 (accessors s)) 1618 1634 (accessors field-name)))))) 1635 1636 (defun %assert-macptr-ftype (macptr ftype) 1637 (if (eq (class-of macptr) *macptr-class*) 1638 (%set-macptr-type macptr (foreign-type-ordinal ftype))) 1639 macptr) 1640 1641 (defun %macptr-ftype (macptr) 1642 (if (eq (class-of macptr) *macptr-class*) 1643 (ordinal-to-foreign-type (%macptr-type macptr)))) 1644 1645 1619 1646 1647
Note:
See TracChangeset
for help on using the changeset viewer.
