Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.8 $; site uiucuxc Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!uiucuxc!pommert From: pommert@uiucuxc.CSO.UIUC.EDU Newsgroups: net.micro.mac Subject: Re: Coroutines needed for Macintosh! Message-ID: <96900013@uiucuxc> Date: Thu, 3-Oct-85 19:02:00 EDT Article-I.D.: uiucuxc.96900013 Posted: Thu Oct 3 19:02:00 1985 Date-Received: Sat, 5-Oct-85 06:30:33 EDT References: <96900012@uiucuxc> Lines: 46 Nf-ID: #R:uiucuxc:96900012:uiucuxc:96900013:000:2440 Nf-From: uiucuxc.CSO.UIUC.EDU!pommert Oct 3 18:02:00 1985 A number of people responded to my base note in person. Their suggestion was as follows: put the main event loop in a procedure and call it from inside the calculating routine, making sure to dim out any menu item which would allow you to start the computational portion up recursively. I agree that in the simple case that this would work and would be reasonable easy to implement. (As I shall comment below, I think that it is one of the two best ways to solve this problem without leaving Pascal.) The part that I don't like about it is that the procedure nesting structure/data structures do not shadow what is going on logically in the program. Therefore, I will need to pass back flags from this routine to the calculation procedure telling it such things as it needs to stop, rescale some data, and so on. There are bigger problems if I tell it that I want to bring up as separate window to display some global results of the calculations performed so far. Maybe I could keep it simple, but I fear that this approach would just lead to a tangled mess. In speaking with Steve Peltz (author of MacPad, Plato terminal simulator) who is familiar with the Lisa Workshop and Lisa Operating System, we were both saying that the Macintosh needs is the ability to do multiprocessing. Then I could fire up a computational process, have my GetNextEvent loop process running, and fire up any other processes that I would need. I could suspend processes as would be necessary, twiddle with parameters (ideally through calling procedures supplied as entry points to that process), et it running again, restart it, or kill it. (Oh, for a good 68020 based operating system!) In summary, this proposed method of dealing with a computationally bound function is a good-as-can-be-helped work around, but perhaps not great in general. My original method would probably work out better for complicated logical processes structures, each with a relatively simple structure. These are the only two good solutions that I can think of while programming in a primative language like Pascal or C. A better solution would be a proper implemetation of coroutines. I believe that the best solution would be multitasking with proper hardware (68010 minimum) and software support. Daniel Pommert Computing Service Office University of Illinois at Urbana-Champaign pommert@uiucuxc.cso.uiuc.edu puree|uiucdcsa|uiucuxc|pommert