Ignore:
Timestamp:
Apr 26, 2005, 6:49:02 AM (15 years ago)
Author:
gb
Message:

Handle protocol methods, protocols in ObjC class decls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/library/parse-ffi.lisp

    r1161 r1172  
    429429
    430430(defun process-ffi-objc-class (form)
    431   (destructuring-bind (source-info class-name superclass-form template-form ivars) (cdr form)
     431  (destructuring-bind (source-info class-name superclass-form protocols ivars) (cdr form)
    432432    (declare (ignore source-info))
    433433    (let* ((class (find-or-create-ffi-objc-class class-name)))
    434434      (setf (ffi-objc-class-ordinal class) (incf *ffi-ordinal*))
    435435      (unless (ffi-objc-class-super-foreign-name class)
    436         (let* ((super-name (cadr superclass-form)))
     436        (let* ((super-name (car superclass-form)))
    437437          (unless (eq super-name :void)
    438438            (setf (ffi-objc-class-super-foreign-name class)
    439439                  super-name))))
    440       (unless (ffi-objc-class-template-structure-name class)
    441         (setf (ffi-objc-class-template-structure-name class)
    442               (cadr (cadr template-form))))
     440      (unless (ffi-objc-class-protocol-names class)
     441        (setf (ffi-objc-class-protocol-names class) protocols))
    443442      (unless (ffi-objc-class-own-ivars class)
    444443        (setf (ffi-objc-class-own-ivars class)
     
    449448  (destructuring-bind (method-type source-info class-name category-name message-name arglist result-type) form
    450449    (declare (ignore source-info category-name))
    451     (let* ((message (find-or-create-ffi-objc-message message-name))
    452            (class-method-p (eq method-type :objc-class-method))
    453            (method
    454             (make-ffi-objc-method :class-name class-name
    455                                   :arglist (mapcar #'reference-ffi-type
    456                                                    arglist)
    457                                   :result-type (reference-ffi-type
    458                                                 result-type)
    459                                   :class-method-p class-method-p)))
    460       (unless (dolist (m (ffi-objc-message-methods message))
    461                 (when (and (equal (ffi-objc-method-class-name m)
    462                                   class-name)
    463                            (eq (ffi-objc-method-class-method-p m)
    464                                class-method-p))
    465                   (return t)))
    466         (push method (ffi-objc-message-methods message))))))
     450    (let* ((flags ()))
     451      (if (or (eq method-type :objc-class-method)
     452              (eq method-type :objc-protocol-class-method))
     453        (setf (getf flags :class) t))
     454      (if (or (eq method-type :objc-protocol-class-method)
     455              (eq method-type :objc-protocol-instance-method))
     456        (setf (getf flags :protocol) t))
     457      (let* ((message (find-or-create-ffi-objc-message message-name))
     458             (class-method-p (getf flags :class))
     459             (method
     460              (make-ffi-objc-method :class-name class-name
     461                                    :arglist (mapcar #'reference-ffi-type
     462                                                     arglist)
     463                                    :result-type (reference-ffi-type
     464                                                  result-type)
     465                                    :flags flags)))
     466        (unless (dolist (m (ffi-objc-message-methods message))
     467                  (when (and (equal (ffi-objc-method-class-name m)
     468                                    class-name)
     469                             (eq (getf (ffi-objc-method-flags m) :class)
     470                                 class-method-p))
     471                    (return t)))
     472          (push method (ffi-objc-message-methods message)))))))
    467473     
    468474(defun process-ffi-typedef (form)
     
    656662                (:struct (push (process-ffi-struct form) defined-types))
    657663                (:objc-class (push (process-ffi-objc-class form) defined-types))
    658                 ((:objc-class-method :objc-instance-method)
     664                ((:objc-class-method
     665                  :objc-instance-method
     666                  :objc-protocol-class-method
     667                  :objc-protocol-instance-method
     668                  )
    659669                 (process-ffi-objc-method form))
    660670                (:function (push (process-ffi-function form) defined-functions))
Note: See TracChangeset for help on using the changeset viewer.