From cabd313483e2f2d23aebb9710458b67f0933f98b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 20 Aug 2021 06:31:14 -0700 Subject: listener: additional reductions in non-termios build. * linenoise/linenoise.c (struct lino_state): these members are now absent in non-termios build: atom_callback, ca_ctx, rawmode, mlmode, clip, result, buf, plen, pos, sel, end, len, dlen, dpos, dsel, dend, cols, oldrow, maxrows, history_index, need_resize, need_refresh, selmode, selinclusive, noninteractive and undo_stack. (lino_set_multiline, lino_get_multiline, lino_set_selinclusive, lino_get_selinculsive, lino_set_noninteractive, lino_get_noninteractive, lino_set_atom_cb): Functions now only defined in termios build. (linenoise): Adjustments for missing members in non-termios mode. (lino_make): We no longer need to set noninteractive to 1 in non-termios build. The flag no longer exists. (lino_copy, lino_cleanup): Avoid referencing nonexistent members in non-termios build. (lino_set_result): Another termios-only function. * linenoise/linenoise.h (lino_set_result, lino_clear_screen, lino_set_multiline, lino_get_multiline, lino_set_selinclusive, lino_get_selinculsive, lino_set_noninteractive, lino_get_noninteractive, lino_atom_cb_t, lino_set_atom_cb): Declare only in termios build. * parser.c (repl): Add #if HAVE_TERMIOS to avoid using linenoise features not available in non-termios build, and to remove any variables that thus become unused. --- linenoise/linenoise.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'linenoise/linenoise.h') diff --git a/linenoise/linenoise.h b/linenoise/linenoise.h index bc72eaa7..4ad3ce64 100644 --- a/linenoise/linenoise.h +++ b/linenoise/linenoise.h @@ -120,6 +120,7 @@ int lino_hist_set_max_len(lino_t *, int len); int lino_hist_save(lino_t *, const wchar_t *filename, int new_only); int lino_hist_load(lino_t *, const wchar_t *filename); int lino_have_new_lines(lino_t *); +#if HAVE_TERMIOS void lino_set_result(lino_t *, wchar_t *); /* takes ownership of malloced mem; modifies it */ int lino_clear_screen(lino_t *); void lino_set_multiline(lino_t *, int ml); @@ -128,10 +129,13 @@ void lino_set_selinclusive(lino_t *, int si); int lino_get_selinculsive(lino_t *); void lino_set_noninteractive(lino_t *, int ni); int lino_get_noninteractive(lino_t *); +#endif void lino_enable_noninteractive_prompt(lino_t *, int enable); +#if HAVE_TERMIOS typedef wchar_t *lino_atom_cb_t(lino_t *, const wchar_t *line, int n, void *ctx); void lino_set_atom_cb(lino_t *, lino_atom_cb_t *, void *ctx); +#endif typedef int lino_enter_cb_t(const wchar_t *line, void *ctx); void lino_set_enter_cb(lino_t *, lino_enter_cb_t *, void *ctx); -- cgit v1.2.3