Thread View: comp.sys.next.programmer
3 messages
3 total messages
Started by Tom West
Fri, 20 Nov 1992 23:24
NeXT Event Loop Question
Author: Tom West
Date: Fri, 20 Nov 1992 23:24
Date: Fri, 20 Nov 1992 23:24
34 lines
1620 bytes
1620 bytes
A more general implementation question from a tyro NeXT programmer.
I am porting over an interpreter to the NeXT. When execution is
called for, the program calls the execution module. It displays
output to its output window and occasionally asks for input from
the same window. Or at least, it should.
I am at a loss as to how I am supposed to:
(1) Have the rest of the system keep responding
(2) Have the execution wait for key input.
Rather kindly, the execution process does come up for air fairly regularly.
Looks like: do
{
running = Execute ();
} while (running != FINISHED)
On other systems, I just insert a call to the main event loop in the
do loop and the application is able (with a little help) to process
events. Is there any equivalent to this on the NeXT?
Is creating a MACH thread my only alternative? That's going to require
much more programming overhead than I would like (to say nothing of the
fact that I would have to learn all about threads in about 2 days :-)).
Is there a simple method of doing all of this that I've missed?
Many thanks in advance.
--
Tom West
west@turing.toronto.edu or "Children of the Blood"
tomwest@gpu.utcs.utoronto.ca or -Michelle Sagara
west@hsa.on.ca
Re: NeXT Event Loop Question
Author: Ron Pomeroy x(Coop)
Date: Mon, 23 Nov 1992 23:59
Date: Mon, 23 Nov 1992 23:59
46 lines
2414 bytes
2414 bytes
In article <1992Nov20.182445.9500@jarvis.csri.toronto.edu>
west@turing.toronto.edu (Tom West) writes:
>> A more general implementation question from a tyro NeXT programmer.
>>
>> I am porting over an interpreter to the NeXT. When execution is
>>called for, the program calls the execution module. It displays
>>output to its output window and occasionally asks for input from
>>the same window. Or at least, it should.
>>
>> I am at a loss as to how I am supposed to:
>> (1) Have the rest of the system keep responding
>> (2) Have the execution wait for key input.
>>
>> Rather kindly, the execution process does come up for air fairly regularly.
>>Looks like: do
>> {
>> running = Execute ();
>> } while (running != FINISHED)
>>
>> On other systems, I just insert a call to the main event loop in the
>>do loop and the application is able (with a little help) to process
>>events. Is there any equivalent to this on the NeXT?
>>
>> Is creating a MACH thread my only alternative? That's going to require
>>much more programming overhead than I would like (to say nothing of the
>>fact that I would have to learn all about threads in about 2 days :-)).
>>Is there a simple method of doing all of this that I've missed?
>>
>> Many thanks in advance.
>>--
>>
>> Tom West
>>
>> west@turing.toronto.edu or "Children of the Blood"
>>tomwest@gpu.utcs.utoronto.ca or -Michelle Sagara
>> west@hsa.on.ca
Just a shot in the dark but...What about using the Subprocess class ? (see
/NeXTDeveloper/Examples/Unix/Subprocess) I used it to talk to a Mathematica
kernel via an external C program (supplied with Mma). Super easy to use.
--
Ronald Pomeroy [Objective-Cruntime: [Smalltalk runtime]];
Advanced Micro Devices [self dream-on];
CAM Applications Group
rpomeroy@aunext1.amd.com (NeXTmail preferred)
Re: NeXT Event Loop Question
Author: Sam Streeper
Date: Tue, 24 Nov 1992 01:38
Date: Tue, 24 Nov 1992 01:38
27 lines
1742 bytes
1742 bytes
west@turing.toronto.edu (Tom West) writes:
> I am porting over an interpreter to the NeXT. (...)
> Rather kindly, the execution process does come up for air fairly regularly.
> Looks like: do
> {
> running = Execute ();
> } while (running != FINISHED)
In the past you have been simply polling the execution loop from the event
loop. The event loop is rather more hidden under NeXTstep, but you can get the
same effect by installing a timed entry that runs the Execute() loop.
Timed entries happen "between" the dispatch of normal events (like keypresses).
You must specify the interval at which you want to invoke the function
(presumably a very small value in your case). One thing to be aware of is that
timed entries normally can go off any time you ask for an event (like "what is
the next key?") A timed entry will never directly reenter the handler function
(that is, the function is locked out until the timed entry returns) but it
could happen if you call the Execute() handler responding to a key-down event
and you look for another event. If you need to do this, a simple semaphore
will keep you happy. Oh yeah, the documentation is under DPSAddTimedEntry().
-sam
--
Opinions expressed herein are not those of my employer. They're not even
mine. They're probably wrong besides. How did they get in here, anyway?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads