From ehlers at ucalgary.ca  Mon May 31 00:37:57 2010
From: ehlers at ucalgary.ca (Peter Ehlers)
Date: Sun, 30 May 2010 16:37:57 -0600
Subject: [Rd] Location of source code for readline()
In-Reply-To: <4C02D9AF.1060207@uottawa.ca>
References: <4C02D9AF.1060207@uottawa.ca>
Message-ID: <4C02E8C5.8080503@ucalgary.ca>

On 2010-05-30 15:33, Prof. John C Nash wrote:
> A few days ago on R-help I asked about a cross-platform timeout version of readline().
> Some suggestions, but only partial joy so far. I can get the Gnu bash  'read -t ...' to
> work in Windows by using the 'bash -c ' construct, but then R's system() function does not
> seem to allow this to pass through. Similarly a Perl and Free Pascal routine that I tried,
> the latter being a single executable that did the prompt and the timeout. (I can send code
> offline if anyone interested -- not fully protected against bad inputs, however.)
>
> Now I'm wondering where the code for readline is located in the R source. I've tracked as
> far as the 'do_readln' in names.c, but now want to find the actual code to see if I can
> patch it, though I am a real novice in C. Suggestions welcome.
>
> My application, FYI, is to have a script that will display something, and wait for a
> keypress (for readline it seems to need the Enter key) but timeout after a preset number
> of seconds. The setTimeLimit "almost" works -- but not for readline. I'm thinking of a
> modified readline like readline(prompt='Do you want to continue?', timeout=6).
>
> Note that the issue seems to be Windows. I haven't a Mac to try, but Linux can be made to
> function by various methods at the top.  Sigh.
>
> JN
>

I can't help with your project, but check scan.c for do_readln.

  -Peter Ehlers



[Rd] Location of source code for readline()
Peter Ehlers