From a3f2c38eb670d9bbd15b6dbaa79e9192068785de Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Mon, 31 Dec 2018 11:05:19 +0100 Subject: [PATCH] upstream editline development at http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/readline/readline.h?sortby=date#rev1.42.2.1 have added two lines to readline.h: typedef int rl_hook_func_t(void); extern rl_hook_func_t *rl_event_hook; ngspice rl_event_hook had originally been defined of type void. The patch redefines the return type to be int. --- src/main.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/src/main.c b/src/main.c index b9460bb21..72028886c 100644 --- a/src/main.c +++ b/src/main.c @@ -21,8 +21,11 @@ /* SJB added editline support 2005-05-05 */ #ifdef HAVE_BSDEDITLINE -# include -extern VFunction *rl_event_hook; /* missing from editline/readline.h */ +#include +#ifndef rl_hook_func_t + typedef int rl_hook_func_t(void); +#endif +extern rl_hook_func_t *rl_event_hook; /* missing from editline/readline.h */ extern int rl_catch_signals; /* missing from editline/readline.h */ #endif @@ -164,16 +167,10 @@ static void app_rl_readlines(void); #if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) static char *prompt(void); -#endif - #ifndef X_DISPLAY_MISSING # include "frontend/plotting/x11.h" -# ifdef HAVE_GNUREADLINE static int app_event_func(void); -# endif -# ifdef HAVE_BSDEDITLINE -static void app_event_func(void); -# endif +#endif #endif static void show_help(void); @@ -184,7 +181,6 @@ static bool read_initialisation_file(char *dir, char *name); static void append_to_stream(FILE *dest, FILE *source); #endif - extern IFsimulator SIMinfo; #ifdef SIMULATOR @@ -566,7 +562,7 @@ prompt(void) #endif /* HAVE_GNUREADLINE || HAVE_BSDEDITLINE */ #ifndef X_DISPLAY_MISSING -#ifdef HAVE_GNUREADLINE +#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) /* -------------------------------------------------------------------------- */ /* Process device events in Readline's hook since there is no where else to do it now - AV */ @@ -579,21 +575,8 @@ app_event_func(void) X11_Input(&reqst, NULL); return 0; } -#endif /* HAVE_GNUREADLINE */ +#endif -#ifdef HAVE_BSDEDITLINE -/* -------------------------------------------------------------------------- */ -/* Process device events in Editline's hook. - similar to the readline function above but returns void */ -static void -app_event_func(void) -/* called by GNU readline periodically to know what to do about keypresses */ -{ - static REQUEST reqst = { char_option, 0 }; - reqst.fp = rl_instream; - X11_Input(&reqst, NULL); -} -#endif /* HAVE_BSDEDITLINE */ #endif /* -------------------------------------------------------------------------- */