« Return to Thread: Child window

Re: Running interpreter from FOX

by Jeroen van der Zijp :: Rate this Message:

Reply to Author | View in Thread

On Tuesday 26 May 2009, Hardy, Stephen wrote:
> Jeroen,
>
> thanks for the tips.  I was looking at coroutines -- that was my first choice since I had experience implementing them in a small embedded system.  Unfortunately, the portable implementation (libpcl) requires one to guess the stack size required.  Not a good thing for an interpreter, where arbitrary user scripts can be run.  Also, libpcl is Unix-only, I think.  
>
> Threads are also a pain, because one has to design a communication protocol, which makes debugging much more difficult.  This application has to be rock-solid (as opposed to high performance), and I'm afraid I don't have time to completely iron out any bugs in a multithreaded application.  So, I'll go with the scheme I initially presented which, if it works, has the advantage of not requiring any OS-dependent libraries.

Some time ago, I had a similar problem.  Note, this was before we had thread support in FOX.

My solution then was to put the interpreter read-eval-print loop in charge, and invoke the
GUI event loop in the gettoken() routine.

This means the user could do anything he wants, but when an input is completed into the interpreter
script window then the interpreter resumes control until whatever function the user typed is completed
and the interpreter gets back to gettoken().

It all felt very natural.

The one tweak you want to add is of course some periodic callback to runWhileEvents() (modal for all
windows) so as to keep the GUI fresh, in case the interpreter executes some long-winded function.


Regards,



                - Jeroen



------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Foxgui-users mailing list
Foxgui-users@...
https://lists.sourceforge.net/lists/listinfo/foxgui-users

 « Return to Thread: Child window