Added support for the BSD licensed editline library (libedit).

This commit is contained in:
sjborley 2005-05-06 23:43:46 +00:00
parent 7545440a55
commit cb247a15fb
5 changed files with 35 additions and 28 deletions

View File

@ -11,13 +11,16 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "com_history.h"
#ifdef HAVE_GNUREADLINE
/* Added GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */
#include <readline/readline.h>
#include <readline/history.h>
#endif /* HAVE_GNUREADLINE */
#ifdef HAVE_BSDEDITLINE
/* SJB added edit line support 2005-05-05 */
#include <editline/readline.h>
#endif /* HAVE_BSDEDITLINE */
/* static declarations */
static wordlist * dohsubst(char *string);
static wordlist * dohmod(char **string, wordlist *wl);
@ -353,7 +356,7 @@ cp_addhistent(int event, wordlist *wlist)
cp_lastone->hi_next = NULL;
cp_lastone->hi_event = event;
cp_lastone->hi_wlist = wl_copy(wlist);
#ifndef HAVE_GNUREADLINE
#if !defined(HAVE_GNUREADLINE) && !defined(HAVE_BSDEDITLINE)
freehist(histlength - cp_maxhistlength);
histlength++;
#endif
@ -494,7 +497,7 @@ com_history(wordlist *wl)
rev = TRUE;
}
#ifdef HAVE_GNUREADLINE
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
/* Added GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */
{
HIST_ENTRY *he;
@ -523,8 +526,7 @@ com_history(wordlist *wl)
cp_hprint(cp_event - 1, cp_event - histlength, rev);
else
cp_hprint(cp_event - 1, cp_event - 1 - atoi(wl->wl_word), rev);
#endif /* ifelse HAVE_GNUREADLINE */
#endif /* defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) */
return;
}

View File

@ -589,10 +589,10 @@ getcommand(char *string)
if (cp_debug)
fprintf(cp_err, "calling getcommand %s\n", string ? string : "");
#ifndef HAVE_GNUREADLINE
#if !defined(HAVE_GNUREADLINE) && !defined(HAVE_BSDEDITLINE)
/* set cp_altprompt for use by the lexer - see parser/lexical.c */
cp_altprompt = get_alt_prompt();
#endif
#endif /* !defined(HAVE_GNUREADLINE) && !defined(HAVE_BSDEDITLINE) */
cp_cwait = TRUE;
wlist = cp_parse(string);

View File

@ -10,16 +10,19 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "ftehelp.h"
#include "hlpdefs.h"
#include "misccoms.h"
#include "circuits.h"
#include "hcomp.h"
#include "variable.h"
#ifdef HAVE_GNUREADLINE
#include <readline/readline.h>
#include <readline/history.h>
#endif
#endif /* HAVE_GNUREADLINE */
#ifdef HAVE_BSDEDITLINE
/* SJB added edit line support 2005-05-05 */
#include <editline/readline.h>
#endif /* HAVE_BSDEDITLINE */
static void byemesg(void);
@ -117,8 +120,7 @@ com_bug(wordlist *wl)
return;
}
#else
#else /* SYSTEM_MAIL */
void
com_bug(wordlist *wl)
@ -127,7 +129,7 @@ com_bug(wordlist *wl)
return;
}
#endif
#endif /* SYSTEM_MAIL */
void
com_version(wordlist *wl)
@ -230,17 +232,16 @@ static void
byemesg(void)
{
#ifdef HAVE_GNUREADLINE
extern char gnu_history_file[];
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
extern char history_file[];
/* write out command history only when saying goodbye. */
if (cp_interactive && (cp_maxhistlength > 0)) {
stifle_history(cp_maxhistlength);
write_history(gnu_history_file);
write_history(history_file);
}
#endif /* HAVE_GNUREADLINE */
#endif /* defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) */
printf("%s-%s done\n", ft_sim->simulator, ft_sim->version);
return;
}

View File

@ -786,8 +786,8 @@ zoomin(GRAPH *graph)
graph->commandline, fx0, fx1, fy0, fy1);
}
/* don't use the following if using GNU Readline - AV */
#ifndef HAVE_GNUREADLINE
/* don't use the following if using GNU Readline or BSD EditLine */
#if !defined(HAVE_GNUREADLINE) && !defined(HAVE_BSDEDITLINE)
{
wordlist *wl;
int dummy;
@ -799,8 +799,7 @@ zoomin(GRAPH *graph)
(void) cp_addhistent(cp_event++, wl);
}
}
#endif /* HAVE_GNUREADLINE */
#endif /* !defined(HAVE_GNUREADLINE) && !defined(HAVE_BSDEDITLINE) */
(void) cp_evloop(buf);

View File

@ -7,7 +7,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
* The signal routines for spice 3 and nutmeg.
*/
#include "ngspice.h"
#include "ifsim.h"
#include "iferrmsg.h"
@ -23,9 +22,13 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
/* from spice3f4 patch to ng-spice. jmr */
#include <readline/readline.h>
#include <readline/history.h>
#include "fteinput.h"
#endif
#ifdef HAVE_BSDEDITLINE
/* SJB added edit line support 2005-05-05 */
#include <editline/readline.h>
#endif /* HAVE_BSDEDITLINE */
extern sigjmp_buf jbuf;
/* The (void) signal handlers... SIGINT is the only one that gets reset (by
@ -59,13 +62,15 @@ ft_sigintr(void)
return; /* just return without aborting simulation if ft_setflag = TRUE */
}
#ifdef HAVE_GNUREADLINE
/* sjb - what to do for editline???
The following are not supported in editline */
#if defined(HAVE_GNUREADLINE)
/* Clean up readline after catching signals */
/* One or all of these might be supurfluous */
/* One or all of these might be superfluous */
(void) rl_free_line_state();
(void) rl_cleanup_after_signal();
(void) rl_reset_after_signal();
#endif
#endif /* defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) */
/* To restore screen after an interrupt to a plot for instance */
cp_interactive = TRUE;