<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>objc:objc-message-send-stret does the trick!  Thanks</div></div><div><br></div><div>alex</div><div><br></div><br><div><div>On Dec 28, 2010, at 1:40 PM, R. Matthew Emerson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On Dec 28, 2010, at 2:55 PM, Alexander Repenning wrote:<br><br><blockquote type="cite">I am having a problem with accessing certain (10.6 and later) objective-C properties which I try to access via objc:objc-message-send<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">something like this works: (objc:objc-message-send some-event "magnification" #>CGFloat)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">but when I specify an NSPoint return type things fall apart:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">(objc:objc-message-send touch-return "normalizedPosition" #>NSPoint)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Error: (TOUCH-RETURN :<SEL> (OBJC:@SELECTOR "normalizedPosition")) should be an even-length list of alternating foreign types and values<br></blockquote><blockquote type="cite"><blockquote type="cite">While executing: X8664::EXPAND-FF-CALL, in process Listener(6).<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I have tried to replace  #>NSPoint with :id which does return something that Lisp does not like:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Error: Invalid memory operation.<br></blockquote><blockquote type="cite"><blockquote type="cite">While executing: CCL::%SAFE-GET-PTR, in process Listener(6).<br></blockquote></blockquote><br><br>Objective-C methods that return structs have to be called differently from methods that return scalars.  The details of why this is so are complicated and probably not that interesting.<br><br>Something like this (warning, typed in mail) is probably what you want.<br><br>(rlet ((pt #>NSPoint))<br>  (objc:objc-message-send-stret pt touch-return "normalizedPosition" #>NSPoint))<br><br>Note that you pass an additional first argument, which is a pointer to some memory into which the returned struct will be stored.<br><br><br></div></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Prof. Alexander Repenning</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><br class="khtml-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px">University of Colorado</p><p style="margin: 0.0px 0.0px 0.0px 0.0px">Computer Science Department</p><p style="margin: 0.0px 0.0px 0.0px 0.0px">Boulder, CO 80309-430</p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><br class="khtml-block-placeholder"></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">vCard: <a href="http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf">http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf</a></font></p><br class="Apple-interchange-newline"></span></span></span></span>
</div>
<br></body></html>