Path: utzoo!attcan!uunet!husc6!bloom-beacon!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.apple Subject: Re: Help with TML PASCAL Message-ID: <16797@apple.Apple.COM> Date: 8 Sep 88 16:34:14 GMT References: <8809081422.AA20731@decwrl.dec.com> Reply-To: keith@apple.com.UUCP (Keith Rollin) Organization: Apple Computer Inc, Cupertino, CA Lines: 29 In article <8809081422.AA20731@decwrl.dec.com> shatara@univse.dec.com writes: >I have been having a problem with TML PASCAL and have not had much luck >getting any answers from TML directly. Can someone out there help? > >I'm having a problem generating a Stop alert by following the TML Pascal >examples given in the "Programmer's Introduction to the IIgs", pp 429-431. I >have followed the examples very closely, but the "TYPE" definition of the >Alert Template was not shown. I am therfore not sure whether or not the >problem is with TML Pascal or with my implementation. I suspect the latter >at this time. > I think I see the problem. You are creating an Alert Template that uses Alert items that you defined locally in a procedure. Pascal creates it's local variable storage space on the stack. When the procedure is done, the stack is cleaned up, and the variables go away. This means that your Alert Items are no longer in the stack proper. However, the Alert Template still points to the location on the stack where they were. When you call StopAlert, a lot of other stuff gets put on the stack (return addresses, parameters to tools, etc.) which overwrites your Alert Items. Since there is now garbage on the stack where the Dialog Manager thinks there is a valid Alert Item, the Dialog Manager chokes and hangs (wow! I mixed my metaphors, but still made sense!). Keith Rollin amdahl\ Developer Technical Support pyramid!sun !apple!keith Apple Computer decwrl/ "You can do what you want to me, but leave my computer alone!"