Bill Allombert on Wed, 20 Jan 2016 18:15:01 +0100


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

Re: Move readline interface to libpari


On Tue, Jan 19, 2016 at 10:20:11AM +0100, Jeroen Demeyer wrote:
> On 2016-01-18 18:01, Bill Allombert wrote:
> >+/* readline */
> >+typedef char* (*readline_GF)(const char*, int); /* generator function
> >*/
> >
> >We can probably dispense with the typedef readline_GF.
> 
> This is a version without readline_GF.

You patch generate a warning:

In file included from ../src/gp/gp_rl.c:23:0:
../src/gp/gp_rl.c: In function ‘init_readline’:
../src/headers/paripriv.h:540:23: warning: right-hand operand of comma
expression has no effect [-Wunused-value]
     (pari_rl).back = 0, \
                       ^
../src/gp/gp_rl.c:371:3: note: in expansion of macro ‘pari_use_readline’
   pari_use_readline(pari_rl);
   ^

Maybe 

#define pari_use_readline(pari_rl)

should be changed to something like:

#define pari_use_readline(pari_rl) do { 
    (pari_rl).line_buffer = &rl_line_buffer; \
    (pari_rl).point = &rl_point; \
    (pari_rl).end = &rl_end; \
    (pari_rl).completion_matches = &rl_completion_matches; \
    (pari_rl).filename_completion_function =
&rl_filename_completion_function; \
    (pari_rl).username_completion_function =
&rl_username_completion_function; \
    (pari_rl).insert = &rl_insert; \
    (pari_rl).completion_append_character =
&rl_completion_append_character; \
    (pari_rl).back = 0; } while(0)

Cheers,
Bill.