[comp.sys.amiga] window/event/conman questions

jellson%stsusa.com@cunyvm.cuny.edu (12/15/89)

In article <4688@sugar.hackercorp.com>, peter@sugar.hackercorp.com (Peter da
 Silva) writes:
> In article <29800002@inmet> rich@inmet.inmet.com writes:
>> I am writing a programming environment (a smalltalk that is derived from
>> Tim Budd's Little Smalltalk, but faster) for Ami.
>
> Cool.
Seconded.

[useful looking code fragments deleted]

>
>> Finally, I am using ConMan's feature of opening a window as a file handle
>> by calling Open() with file name "con:wXXXX" where XXXX is the address of
>> the opened window.
>
> Please don't do this. There are ways of attaching a console device to a
 window,
> and I'm sure that someone will come up with one for you. If you depend on
> ConMan, you'll be unable to run your program on any system that doesn't have
> it. For something like Smalltalk, that'd be too bad.
> --

Ok, so don't depend on ConMan, but if it is there please support it. I really
miss ConMans line editing and history functions in the XLISP environment.

---
John Ellson  ellson@ontap.stsusa.com

waggoner%dtg.nsc.com@cunyvm.cuny.edu (12/15/89)

In article <4688@sugar.hackercorp.com> peter@sugar.hackercorp.com (Peter da
 Silva) writes:
>In article <29800002@inmet> rich@inmet.inmet.com writes:

(among other things)

>> I am writing a programming environment (a smalltalk that is derived from
>> Tim Budd's Little Smalltalk, but faster) for Ami.
...
>> What happen if a program opens multiple windows and each one ants to wait
>> for some events?  How does one code that?
>
>Say you have a null-terminated array of windows, w:
>
>       bits = 0;
>       for(i = 0; w[i]; i++)
>               bits |= 1<<w->UserPort->mp_SigBit;
>       for(;;)
>       {
>               for(i = 0; w[i]; i++)
>                       if(msg = GetMsg(w->UserPort)) {
>                               if(handleEvent(msg))
>                                       goto break2;
>                               break;
>                       }
>               if(!msg)
>                       wait(bits);
>       }
>break2:        /* So sue me for using a goto. I wanted to make it match his cod
e
>        * pretty closely. This was the cleanest way.
>        */

You can also use just one signal bit for all the windows you open.
This is fairly well documented in the old intuition manual and the
newer (blue) rom kernal manual.  You basically open each new window
with NO IDCMP flags.  Then, copy the w->UserPort from an already open
window, or from a port you have already opened, to the UserPort of the
new window.  Now, use ModifyIDCMP to set the flags you want.


Then, before closing the window, NULL the UserPort so it doesn't get
closed and deallocated by CloseWindow.  This is the only way to
support an arbitrarily large number of windows.  You must use the
WindowPtr field of the IDCMP messages to distinguish which window the
message came from and process it accordingly.






These posters that make you write more than you include are a pain.


--
 ,------------------------------------------------------------------.
|  Mark Waggoner   (408) 721-6306           waggoner@dtg.nsc.com     |
 `------------------------------------------------------------------'