Current-Users archive

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

Re: libedit trouble



On Fri, Feb 20, 2009 at 07:03:50PM +0000, Alistair Crooks wrote:
> Christos and I briefly talked about the variadic function, and I
> thought the same as him, but obviously not. What I'd propose is a
> different approach to the problem of getting at a private data pointer
> from within the user-supplied prompt function, when all you have
> available is a pointer to an EditLine struct (which is itself opaque).
> 
> 1. Modify the EditLine struct to have a void * private data pointer.
> 
> 2. provide an el_set(edit, EL_PRIVATE_DATA, void *vp) function
> 
> 3. provide a corresponding el_get(edit, EL_PRIVATE_DATA, void *vp) function
> to return the same value
> 
> 4. Keep the EL_PROMPT signature as it was previously (we have no way of
> ensuring that third-party code is not in the same boat as bc was)
> 
> That way we can access a pointer to a private structure anywhere, and
> retrieve the pointer from within the prompting function.

Indeed, if I was going to do this, I'd model it on the existing
EL_CLIENTDATA implementation.

*sigh*

Someone hit me, please.

Thanks,
Alistair


Home | Main Index | Thread Index | Old Index