ffi/unsafe/com: com-object->eq?' implies
equal?'
This commit is contained in:
parent
e05e549021
commit
89ef600b6e
|
@ -480,7 +480,14 @@
|
|||
[connection-cookie #:mutable]
|
||||
[sink #:mutable]
|
||||
[types #:mutable]
|
||||
[mref #:mutable]))
|
||||
[mref #:mutable])
|
||||
#:property prop:equal+hash (list
|
||||
(lambda (a b eql?)
|
||||
(ptr-equal? (com-object-unknown a) (com-object-unknown b)))
|
||||
(lambda (a ehc)
|
||||
(ehc (com-object-unknown a)))
|
||||
(lambda (a ehc2)
|
||||
(ehc2 (com-object-unknown a)))))
|
||||
|
||||
(define (com-object-eq? a b)
|
||||
(check-com-obj 'com-object-eq? a)
|
||||
|
|
|
@ -78,7 +78,7 @@ produces a @tech{ProgID} with its version.}
|
|||
|
||||
@defproc[(com-object? [obj com-object?]) boolean?]{
|
||||
|
||||
Returns @racket[#t] if the argument is a COM object, @racket[#f]
|
||||
Returns @racket[#t] if the argument represents a @tech{COM object}, @racket[#f]
|
||||
otherwise.}
|
||||
|
||||
|
||||
|
@ -135,8 +135,13 @@ unsafe operations).}
|
|||
@defproc[(com-object-eq? [obj1 com-object?] [obj2 com-object?])
|
||||
boolean?]{
|
||||
|
||||
Returns @racket[#t] if the two COM objects are the same,
|
||||
@racket[#f] otherwise.}
|
||||
Returns @racket[#t] if @racket[obj1] and @racket[obj2] refer to the
|
||||
same @tech{COM object}, @racket[#f] otherwise.
|
||||
|
||||
If two references to a COM object are the same according to
|
||||
@racket[com-object-eq?], then they are also the same according to
|
||||
@racket[equal?]. Two @racket[com-object-eq?] references are not
|
||||
necessarily @racket[eq?], however.}
|
||||
|
||||
|
||||
@defproc[(com-type? [v any/c]) boolean?]{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#lang racket/base
|
||||
(require ffi/com
|
||||
(only-in ffi/unsafe/com make-com-object)
|
||||
racket/system
|
||||
setup/dirs)
|
||||
|
||||
|
@ -39,6 +40,11 @@
|
|||
(test #t (guid=? (progid->clsid mzcom-progid) (com-object-clsid mzcom)))
|
||||
(test (void) (com-object-set-clsid! mzcom (progid->clsid mzcom-progid)))
|
||||
(test #t (com-object-eq? mzcom mzcom))
|
||||
(let ([mzcom2 (make-com-object (com-object-get-iunknown mzcom) #f)])
|
||||
(test #t (com-object-eq? mzcom mzcom2))
|
||||
(test #t (equal? mzcom mzcom2))
|
||||
(test (equal-hash-code mzcom) (equal-hash-code mzcom2))
|
||||
(test (equal-secondary-hash-code mzcom) (equal-secondary-hash-code mzcom2)))
|
||||
(test '("About" "Eval" "Reset") (com-methods mzcom))
|
||||
(test '("About" "Eval" "Reset") (com-methods (com-object-type mzcom)))
|
||||
(test '(-> () void) (com-method-type mzcom "About"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user