[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Pushing events between C++ and Scheme + timers

From: felix winkelmann
Subject: Re: [Chicken-users] Pushing events between C++ and Scheme + timers
Date: Wed, 8 Dec 2004 20:41:09 +0100

On Wed, 8 Dec 2004 18:18:45 +0000, Joel Reymont <address@hidden> wrote:
> Fellow Schemers,
> I have 3 event-related needs:
> 1. I need to push events from C++ to Scheme
> 2. I need to push events from Scheme to C++
> 3. I need to setup timers within Scheme that would also generate events
> I could have C++ call a Scheme function and have the Scheme function
> return data. This would cover 1 and 2 except I would need to pass a list
> of events back into Scheme.
> Sometimes I need to pass events from Scheme to C++ this could be one
> event or it could be a few.
> Last but not least, I need to generate an event (i.e. do something) when
> a timer expires. All my processing could be done in a blocking fashion if
> it weren't for timers.

Does the loop run continuously? You could call into Scheme periodically,
for example by checking timeouts for all suspended game states. If the 
call into Scheme happens periodically, you could run a separate
(Scheme-level) background thread to check for this.

You can pass an incoming event as an s-expr to the Scheme side,
and receive the reply s-expr as a string as result, passing it back.

Does this sound stupid? It's kind of difficult  to suggest something, since
so much depends on how your architecture is. I agree that a complete
port to Scheme (of the SDL and networking layer) is too much.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]