Add 2 functions: el_data_set() and el_data_get() which do what you
would expect. (Allow user data to be associated with an EditLine context). As this changes no existing interfaces and doesn't alter any structs visable to the user I've been told that its not necessary to bump the version of the library.
This commit is contained in:
parent
4033a962bf
commit
90cc1fbc53
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50070
@ -1,4 +1,4 @@
|
||||
/* $Id$ */
|
||||
/* $Id: histedit.h,v 1.3 1997/06/25 09:47:31 msmith Exp $ */
|
||||
/* $NetBSD: histedit.h,v 1.5 1997/04/11 17:52:45 christos Exp $ */
|
||||
|
||||
/*-
|
||||
@ -131,6 +131,9 @@ int el_source __P((EditLine *, const char *));
|
||||
*/
|
||||
void el_resize __P((EditLine *));
|
||||
|
||||
void el_data_set __P((EditLine *, void *));
|
||||
void * el_data_get __P((EditLine *));
|
||||
|
||||
|
||||
/*
|
||||
* User-defined function interface.
|
||||
|
@ -16,7 +16,8 @@ MLINKS= editline.3 el_init.3 editline.3 el_end.3 editline.3 el_reset.3 \
|
||||
editline.3 el_parse.3 editline.3 el_set.3 editline.3 el_source.3 \
|
||||
editline.3 el_resize.3 editline.3 el_line.3 \
|
||||
editline.3 el_insertstr.3 editline.3 el_deletestr.3 \
|
||||
editline.3 history_init.3 editline.3 history_end.3 editline.3 history.3
|
||||
editline.3 history_init.3 editline.3 history_end.3 editline.3 \
|
||||
history.3 el_data_get.3 el_data_set.3
|
||||
|
||||
|
||||
# For speed and debugging
|
||||
|
@ -33,7 +33,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.\" $Id: editline.3,v 1.6 1999/07/12 20:49:33 nik Exp $
|
||||
.\"
|
||||
.Dd January 11, 1997
|
||||
.Os BSD 4.4
|
||||
@ -53,6 +53,8 @@
|
||||
.Nm el_line ,
|
||||
.Nm el_insertstr ,
|
||||
.Nm el_deletestr ,
|
||||
.Nm el_data_set ,
|
||||
.Nm el_data_get ,
|
||||
.Nm history_init ,
|
||||
.Nm history_end ,
|
||||
.Nm history
|
||||
@ -85,6 +87,10 @@
|
||||
.Fn el_insertstr "EditLine *e" "char *str"
|
||||
.Ft void
|
||||
.Fn el_deletestr "EditLine *e" "int count"
|
||||
.Ft void
|
||||
.Fn el_data_set "EditLine *e" "void *data"
|
||||
.Ft void *
|
||||
.Fn el_data_get "EditLine *e"
|
||||
.Ft History *
|
||||
.Fn history_init
|
||||
.Ft void
|
||||
@ -412,6 +418,12 @@ is empty or won't fit, and 0 otherwise.
|
||||
Delete
|
||||
.Fa num
|
||||
characters before the cursor.
|
||||
.It Fn el_data_set
|
||||
Set the user data to
|
||||
.Fa data
|
||||
.
|
||||
.It Fn el_data_get
|
||||
Get the user data.
|
||||
.El
|
||||
.Sh HISTORY LIST FUNCTIONS
|
||||
The history functions use a common data structure,
|
||||
|
@ -103,6 +103,7 @@ el_init(prog, fin, fout)
|
||||
(void) prompt_init(el);
|
||||
(void) sig_init(el);
|
||||
el->el_flags = 0;
|
||||
el->data = NULL;
|
||||
|
||||
return el;
|
||||
} /* end el_init */
|
||||
@ -336,3 +337,22 @@ el_resize(el)
|
||||
|
||||
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||
}
|
||||
|
||||
public void
|
||||
el_data_set (el, data)
|
||||
EditLine *el;
|
||||
void *data;
|
||||
{
|
||||
el->data = data;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public void *
|
||||
el_data_get (el)
|
||||
EditLine *el;
|
||||
{
|
||||
if (el->data)
|
||||
return (el->data);
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -125,6 +125,8 @@ struct editline {
|
||||
el_history_t el_history; /* History stuff */
|
||||
el_search_t el_search; /* Search stuff */
|
||||
el_signal_t el_signal; /* Signal handling stuff */
|
||||
|
||||
void *data; /* user data */
|
||||
};
|
||||
|
||||
#endif /* _h_el */
|
||||
|
Loading…
Reference in New Issue
Block a user