Changeset 5793


Ignore:
Timestamp:
Jan 25, 2007, 3:37:51 AM (18 years ago)
Author:
Gary Byers
Message:

Never fully understood the concept "auxiliary" foreign types, but try to
canonicalize intermediate struct/union/enum references, so that
(EQ (PARSE-FOREIGN-TYPE '(:STRUCT :FOO))

(PARSE-FOREIGN-TYPE '(:STRUCT :FOO)))

is more likely to return T (e.g., something registered in the FTD.

It seems clear that this is the right thing when the structure reference
is in global scope; I'm not sure what it'd mean for that not to be the
case.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/foreign-types.lisp

    r5787 r5793  
    392392
    393393(defun auxiliary-foreign-type (kind name &optional (ftd *target-ftd*))
    394   (flet ((aux-defn-matches (x)
    395            (and (eq (first x) kind) (eq (second x) name))))
    396     (let ((in-auxiliaries
    397            (or (find-if #'aux-defn-matches *new-auxiliary-types*)
    398                (find-if #'aux-defn-matches *auxiliary-type-definitions*))))
    399       (if in-auxiliaries
    400           (values (third in-auxiliaries) t)
    401           (ecase kind
    402             (:struct
    403              (info-foreign-type-struct name ftd))
    404             (:union
    405              (info-foreign-type-union name ftd))
    406             (:enum
    407              (info-foreign-type-enum name ftd)))))))
    408 
    409 (defun %set-auxiliary-foreign-type (kind name defn)
     394  (or
     395   (ecase kind
     396     (:struct
     397      (info-foreign-type-struct name ftd))
     398     (:union
     399      (info-foreign-type-union name ftd))
     400     (:enum
     401      (info-foreign-type-enum name ftd)))
     402   (flet ((aux-defn-matches (x)
     403            (and (eq (first x) kind) (eq (second x) name))))
     404     (let ((in-auxiliaries
     405            (or (find-if #'aux-defn-matches *new-auxiliary-types*)
     406                (find-if #'aux-defn-matches *auxiliary-type-definitions*))))
     407       (if in-auxiliaries
     408         (values (third in-auxiliaries) t))))))
     409
     410(defun %set-auxiliary-foreign-type (kind name defn &optional (ftd *target-ftd*))
    410411  (flet ((aux-defn-matches (x)
    411412           (and (eq (first x) kind) (eq (second x) name))))
     
    415416      (error "Attempt to shadow definition of ~A ~S." kind name)))
    416417  (push (list kind name defn) *new-auxiliary-types*)
     418  (ecase kind
     419    (:struct
     420     (setf (info-foreign-type-struct name ftd) defn))
     421    (:union
     422     (setf (info-foreign-type-union name ftd) defn))
     423    (:enum
     424     (setf (info-foreign-type-enum name ftd) defn)))
    417425  defn)
    418426
Note: See TracChangeset for help on using the changeset viewer.