Bill Allombert on Mon, 18 Jan 2016 15:46:01 +0100


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

Re: Move readline interface to libpari


On Mon, Jan 18, 2016 at 12:33:33PM +0100, Jeroen Demeyer wrote:
> On 2016-01-18 11:08, Bill Allombert wrote:
> >On Thu, Jan 14, 2016 at 10:20:48AM +0100, Jeroen Demeyer wrote:
> >>New version of patch with extended comment for pari_use_readline()
> >
> >As a start, could you change the patch so that pari_rl is an argument to
> >pari_completion* instead of a public global variable ?
> I cannot change the signature of pari_completion() since it needs to
> be compatible with readline: the function pari_completion() needs to
> be a
> rl_completion_func_t.
 
I expected that pari_completion would be a tool called by the actual
readline call back, rather than being a valid callback.

The user would do:

char **
my_completion(char *text, int START, int END)
{
  ...
  pari_completion(rl, text, START, END);
  ...
}
and then set 
rl_attempted_completion_function = (rl_completion_func_t*) my_completion;

Having public global variables is something we should avoid.

Cheers,
Bill.