From cfb36ab13d53f2d9134ff6d1a3569eb8d192940b Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Tue, 7 Aug 2007 17:36:51 +0200 Subject: Rename EQUAL to OBJC-EQUAL, remove EQUALP, and add OBJC-EQL. darcs-hash:cdfa90ce969b54473cb0aef9c5ac29ecd81c1da4 --- Lisp/defpackage.lisp | 6 ++-- Lisp/tests.lisp | 2 +- Lisp/utilities.lisp | 89 +++++++++++++++++++++++++++------------------------- 3 files changed, 49 insertions(+), 48 deletions(-) (limited to 'Lisp') diff --git a/Lisp/defpackage.lisp b/Lisp/defpackage.lisp index 6fd992a..c3008af 100644 --- a/Lisp/defpackage.lisp +++ b/Lisp/defpackage.lisp @@ -1,8 +1,6 @@ (defpackage #:mulk.objective-cl (:nicknames #:objcl #:objective-cl #:mulk.objcl) (:use #:cl #:cffi #:split-sequence) - (:shadow #:equal - #:equalp) ;; Functions (:export #:initialise-runtime @@ -14,8 +12,8 @@ #:find-selector ;; Generic functions - #:equal - #:equalp + #:objc-eql + #:objc-equal ;; Special variables #:*trace-method-calls* diff --git a/Lisp/tests.lisp b/Lisp/tests.lisp index 7c2b496..5a06963 100644 --- a/Lisp/tests.lisp +++ b/Lisp/tests.lisp @@ -1,5 +1,5 @@ (defpackage #:mulk.objective-cl.tests - (:use #:cl #:lift #:mulk.objective-cl)) + (:use #:lift #:mulk.objective-cl #:cl)) (in-package #:mulk.objective-cl.tests) diff --git a/Lisp/utilities.lisp b/Lisp/utilities.lisp index 9867dc0..3a8e5da 100644 --- a/Lisp/utilities.lisp +++ b/Lisp/utilities.lisp @@ -1,8 +1,8 @@ (in-package #:mulk.objective-cl) -(defgeneric equal (x y)) -(defgeneric equalp (x y)) +(defgeneric objc-eql (x y)) +(defgeneric objc-equal (x y)) (defun truep (b) @@ -10,6 +10,10 @@ (null b)))) +(defun id-eql (x y) + (pointer-eq (pointer-to x) (pointer-to y))) + + (defun id-equal (x y) (truep (if (typep x '(or id objc-class exception)) (invoke x :is-equal y) @@ -18,64 +22,63 @@ (invoke y :is-equal x))))) -(defmethod equal (x y) - (cl:equal x y)) +(defmethod objc-eql (x y) + (cl:eql x y)) -(defmethod equal ((x id) y) - (id-equal x y)) +(defmethod objc-eql ((x id) y) + (id-eql x y)) -(defmethod equal (x (y id)) - (id-equal x y)) +(defmethod objc-eql (x (y id)) + (id-eql x y)) -(defmethod equal ((x objc-class) y) - (id-equal x y)) +(defmethod objc-eql ((x objc-class) y) + (id-eql x y)) -(defmethod equal (x (y objc-class)) - (id-equal x y)) +(defmethod objc-eql (x (y objc-class)) + (id-eql x y)) -(defmethod equal ((x exception) y) - (id-equal x y)) +(defmethod objc-eql ((x exception) y) + (id-eql x y)) -(defmethod equal (x (y exception)) - (id-equal x y)) +(defmethod objc-eql (x (y exception)) + (id-eql x y)) -(defmethod equal ((x selector) (y selector)) - (equal (selector-name x) (selector-name y))) +(defmethod objc-eql ((x selector) (y selector)) + (eql (selector-name x) (selector-name y))) -(defmethod equal ((x selector) (y string)) - (equal (selector-name x) y)) +(defmethod objc-eql ((x selector) (y string)) + (eql (selector-name x) y)) -(defmethod equal ((x string) (y selector)) - (equal x (selector-name y))) +(defmethod objc-eql ((x string) (y selector)) + (eql x (selector-name y))) -(defmethod equalp (x y) - (cl:equalp x y)) +(defmethod objc-equal (x y) + (cl:equal x y)) -(defmethod equalp ((x id) y) - (equal x y)) +(defmethod objc-equal ((x id) y) + (id-equal x y)) -(defmethod equalp (x (y id)) - (equal x y)) +(defmethod objc-equal (x (y id)) + (id-equal x y)) -(defmethod equalp ((x objc-class) y) - (equal x y)) +(defmethod objc-equal ((x objc-class) y) + (id-equal x y)) -(defmethod equalp (x (y objc-class)) - (equal x y)) +(defmethod objc-equal (x (y objc-class)) + (id-equal x y)) -(defmethod equalp ((x exception) y) - (equal x y)) +(defmethod objc-equal ((x exception) y) + (id-equal x y)) -(defmethod equalp (x (y exception)) - (equal x y)) +(defmethod objc-equal (x (y exception)) + (id-equal x y)) -;; FIXME: Does this even make sense? -(defmethod equalp ((x selector) (y selector)) - (equalp (selector-name x) (selector-name y))) +(defmethod objc-equal ((x selector) (y selector)) + (equal (selector-name x) (selector-name y))) -(defmethod equalp ((x selector) (y string)) - (equalp (selector-name x) y)) +(defmethod objc-equal ((x selector) (y string)) + (equal (selector-name x) y)) -(defmethod equalp ((x string) (y selector)) - (equalp x (selector-name y))) +(defmethod objc-equal ((x string) (y selector)) + (equal x (selector-name y))) -- cgit v1.2.3