Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!ftp!poopsie!bootsie!olson From: olson@bootsie.UUCP (Eric Olson) Newsgroups: comp.sys.mac.programmer Subject: Re: Lightspeed C programming questions?? Message-ID: <11@bootsie.UUCP> Date: 8 Feb 90 22:15:52 GMT References: <1990Feb7.174811.3550@aucs.uucp> Reply-To: olson@bootsie.UUCP (Eric Olson) Distribution: na Organization: Lexington Software Design, Lexington, MA Lines: 54 My mail to you bounced. This was recently discussed in this newsgroup, sorry to those who've seen it all before. Your problem is a known misfeature of the glue for Think C (and MPW) provided by Apple. Basically, there is only _one_ actual clickLoop field, the _last_ one set with SetClikLoop (this is because clickLoop procedures need some glue, so the glue routine is the real global). The solution is to write your own glue routine, and stuff it into the clikLoop field directly, pointing at your clikLoop Routine directly. An example: /*============================================================================= TEClickGlue THINK C's SetClikLoop function always points to a piece of code like this, but with jsr to the last address set with SetClikLoop. This caused every TE Record to share a ClickLoop function (the last one set with SetClikLoop). We stuff the TE clikLoop field directly in initialization, and point it here, to avoid this problem. =============================================================================*/ static Boolean TEClickGlue() { asm { move.l d2,-(a7) /* Must preserve d2 */ clr.b -(a7) /* Space for a Boolean return */ jsr TEClickLoop /* Call the Pascal routine */ move.b (a7)+,d0 /* Pop the result into d0 */ move.l (a7)+,d2 /* Restore d2 */ tst.b d0 /* Set status flags for result */ } /******************** * We don't put a rts at the end because if compiled with * profiling on, a stack frame is generated and it needs * to be UNLINKed by falling through. * * If Profiling isn't on, no stack frame is generated and * this function compiles with a simple rts at the end anyway. ********************/ } Good Luck! -Eric -- Please note! olson@bootsie.uucp will not work! Use an address below: Eric K. Olson Internet: olson@endor.harvard.edu Lexington Software Design Usenet: harvard!endor!olson 72A Lowell St. Applelink: olson@endor.harvard.edu@dasnet# Lexington, MA 02173 Compuserve: >INTERNET:olson@endor.harvard.edu (617) 863-9624 Bitnet: OLSON@HARVARD