From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e429176c9adb07b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-22 14:50:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: [OT] Best way to isolate a GUI? (The final concensous?) References: X-Newsreader: Tom's custom newsreader Message-ID: <09T5a.202544$tq4.5037@sccrnsc01> NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1045954236 12.234.13.56 (Sat, 22 Feb 2003 22:50:36 GMT) NNTP-Posting-Date: Sat, 22 Feb 2003 22:50:36 GMT Organization: AT&T Broadband Date: Sat, 22 Feb 2003 22:50:36 GMT Xref: archiver1.google.com comp.lang.ada:34445 Date: 2003-02-22T22:50:36+00:00 List-Id: The "Windows message loop" is a message, rather than callback, oriented system. Each "window" (which doesn't have to be a visible screen window, BTW) is a message queue. You loop around getting messages and sending them off to procedures/tasks/whatever to process them. There are many different possible messages, each with its own data format. It does have the timing latency disadvantages of a polling, rather than interrupt driven, system, so some stuff (multimedia for instance) is callback driven. But most Windows processing involves tasks pulling messages out of message queues. Claw has an internal message loop that turns messages into tagged type dispatching calls, ie, callbacks. The callbacks aren't random registered procedure addresses, but are overrides of objects' primitive procedures. The result is very much an object, rather than process, noun/adjective rather than verb, structure. Thus instead of a task getting a "mouse moved" msg, which causes it to call the Recalculate_Wireframe_Projection and then the Display_2D procedures, say, you design an object (reusable, one hopes) called Wireframe_Window which is a descendant of Basic_Window and override it's When_Mousemove procedure with code to recalculate and display given the new mouse position. If the app wants to change the object displayed (as opposed to the screen display) it changes (x,y,z) data, then Invalidates the Wireframe_Window, thus causing a message to be placed in the message queue, finally resulting in a call on Wireframe_Window's When_Draw procedure. That procedure knows nothing about where the data came from or how the current mouse position got to where it is, but it does know how to render the wireframe view of the data given the mouse position. If you later decide the 3D display should be red-blue stereo, the changes are strictly internal to Wireframe_Window. It's more of a delegated authority, everyone on the team does his job, style rather than central command and control. You tend to think more in terms of goals than actions, eg, "set a course due North" rather than "turn the wheel to the port, then straighten it when the ship is traveling due North". Not "Do this then that" but "Make it so".