Re: [Rd] Plot window does not update in embedded code

From: Jan van der Laan <djvanderlaan_at_gmail.com>
Date: Thu, 22 Jul 2010 09:31:41 +0200

Thomas, Simon,

Thank you for your answers. I will have a look at the code Thomas gave me and probably also have another look at src/unix/sys-std.c. I'll get back when I have this working, or, more likely, when I can't get this to work.

As for the example code. I know it is very fragile. I tried to make a minimal complete example that showed the problem without having to attach hundreds of lines of code that nobody will read. However, what parts are unix specific? Is it the int Rf_initialize_R and R_running_as_main_program? What non os specific options do I have?

Again thank you for your answers.

Regards,

Jan

On Wed, Jul 21, 2010 at 10:52 PM, Simon Urbanek <simon.urbanek_at_r-project.org> wrote:
>
> On Jul 21, 2010, at 4:28 PM, Simon Urbanek wrote:
>
>> Use
>> R_CheckUserInterrupt()
>>
>
> Actually, the above is true but assumes that you're running R's REPL and not your own R_ReadConsole (it will work even in your ReadConsole but unix handlers are not run in that case so only some events will work).
>
>
>> The code below is very fragile and unix-specific.
>>
>
> That is true, too, but even after R_ProcessEvenrts refactorization the handlers are still-unix specific so I stand corrected and you still have to run handlers manually (note that you don't need PolledEvents anymore since they are part of the handlers).
>
> Cheers,
> Simon
>
>
>>>
>>> On Wednesday 21 July 2010, Jan van der Laan wrote:
>>>> How do I ensure that the windows keep being updated?
>>>
>>> in RKWard we run the following periodically during idle phases:
>>>
>>>
>>> // this basically copied from R's unix/sys-std.c (Rstd_ReadConsole)
>>> #ifndef Q_WS_WIN
>>> for (;;) {
>>> fd_set *what;
>>> what = R_checkActivityEx(R_wait_usec > 0 ? R_wait_usec : 50, 1,
>>> Rf_onintr);
>>> R_runHandlers(R_InputHandlers, what);
>>> if (what == NULL) break;
>>> }
>>> /* This seems to be needed to make Rcmdr react to events. Has this always
>>> been the case? It was commented out for a long time, without anybody noticing.
>>> */
>>> R_PolledEvents ();
>>> #else
>>> R_ProcessEvents();
>>> #endif
>>>
>>>
>>> Regards
>>> Thomas
>>> ______________________________________________
>>> R-devel_at_r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>> ______________________________________________
>> R-devel_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 22 Jul 2010 - 07:36:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 22 Jul 2010 - 21:00:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive