PR/14188: Anthony Mallet: Provide an opaque data pointer to client programs.

This commit is contained in:
christos 2001-10-09 13:50:29 +00:00
parent 76e9d7eb12
commit 545f12e0c5
5 changed files with 31 additions and 7 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: editline.3,v 1.23 2001/10/04 00:45:19 lukem Exp $
.\" $NetBSD: editline.3,v 1.24 2001/10/09 13:50:29 christos Exp $
.\"
.\" Copyright (c) 1997-1999 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -379,6 +379,13 @@ and
.Fn el_getc .
The builtin function can be set or restored with the special function
name ``EL_BUILTIN_GETCFN''.
.It Dv EL_CLIENTDATA , Fa "void *data"
Register
.Fa data
to be associated with this EditLine structure. It can be retrieved with
the corresponding
.Fn el_get
call.
.El
.It Fn el_get
Get
@ -413,6 +420,12 @@ Return non-zero if editing is enabled.
.It Dv EL_GETCFN, Fa "int (**f)(EditLine *, char *)"
Return a pointer to the function that read characters, which is equal to
``EL_BUILTIN_GETCFN'' in the case of the default builtin function.
.It Dv EL_CLIENTDATA , Fa "void **data"
Retrieve
.Fa data
previously registered with the corresponding
.Fn el_set
call.
.El
.It Fn el_source
Initialise

View File

@ -1,4 +1,4 @@
/* $NetBSD: el.c,v 1.23 2001/09/27 19:29:50 christos Exp $ */
/* $NetBSD: el.c,v 1.24 2001/10/09 13:50:30 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
__RCSID("$NetBSD: el.c,v 1.23 2001/09/27 19:29:50 christos Exp $");
__RCSID("$NetBSD: el.c,v 1.24 2001/10/09 13:50:30 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -255,6 +255,10 @@ el_set(EditLine *el, int op, ...)
break;
}
case EL_CLIENTDATA:
el->el_data = va_arg(va, void *);
break;
default:
rv = -1;
}
@ -370,6 +374,11 @@ el_get(EditLine *el, int op, void *ret)
rv = 0;
break;
case EL_CLIENTDATA:
*((void **)ret) = el->el_data;
rv = 0;
break;
default:
rv = -1;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: el.h,v 1.9 2001/09/27 19:29:50 christos Exp $ */
/* $NetBSD: el.h,v 1.10 2001/10/09 13:50:30 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -117,6 +117,7 @@ struct editline {
coord_t el_cursor; /* Cursor location */
char **el_display; /* Real screen image = what is there */
char **el_vdisplay; /* Virtual screen image = what we see */
void *el_data; /* Client data */
el_line_t el_line; /* The current line information */
el_state_t el_state; /* Current editor state */
el_term_t el_term; /* Terminal dependent stuff */

View File

@ -1,4 +1,4 @@
/* $NetBSD: histedit.h,v 1.17 2001/09/27 19:29:50 christos Exp $ */
/* $NetBSD: histedit.h,v 1.18 2001/10/09 13:50:30 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -127,6 +127,7 @@ int el_get(EditLine *, int, void *);
#define EL_EDITMODE 11 /* , int); */
#define EL_RPROMPT 12 /* , el_pfunc_t); */
#define EL_GETCFN 13 /* , el_rfunc_t); */
#define EL_CLIENTDATA 14 /* , void *); */
#define EL_BUILTIN_GETCFN (NULL)

View File

@ -1,5 +1,5 @@
# $NetBSD: shlib_version,v 1.11 2001/01/01 15:54:07 jdolecek Exp $
# $NetBSD: shlib_version,v 1.12 2001/10/09 13:50:30 christos Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
major=2
minor=5
minor=6