850860w@aucs.uucp (VINCENT W. WHYNOT) (02/08/90)
I am using Lightspeed C version 2.15 to develop an application for my Honors
thesis. There are several issues I need help on:
1) My application will generate code (Lightspeed C code) for a scanner and
a parser. Once this code is generated I want to allow the user to test it
from within my application. Is there any way of compiling and linking these
code modules without leaving my application and going to Lightspeed C?
2) I am also having trouble with an automatic scrolling routine installed
with SetClikLoop(). On the Mac Plus (which I am using) the default ClikLoop
routine will scroll text during text selection but will not adjust the
vertical scroll bar accordingly. My ClikLoop routine simply scrolls text
during text selection while adjusting the scroll bar. My ClikLoop routine
is defined as follows:
pascal BOOLEAN AutoScroll()
{
blah, blah, blah;
return(TRUE);
}
When I install this routine with SetClikLoop, text cannot even be selected
by dragging (inside or outside the window). Any comments?
Any help is appreciated,
Wade
olson@bootsie.UUCP (Eric Olson) (02/09/90)
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