Fixed issues with the alternate prompt. Translations for German comments provided by Dietmar Warning. fixed readline with ngnutmeg. Updated copyright date for --help. Tidy to removed some compiler warnings.
This commit is contained in:
parent
a1991eee19
commit
e602232500
14
ChangeLog
14
ChangeLog
|
|
@ -1,3 +1,17 @@
|
||||||
|
2005-05-04 Steven Borley <steven.borley@virgin.net>
|
||||||
|
|
||||||
|
* Fixed issues with the alternate prompt (src/main.c, src/frontent/control.c
|
||||||
|
and src/include/cpextern.h) - a format problem when used with readline and
|
||||||
|
a buffer overrun. Also reduced max number of chevrons to 16 and added + at
|
||||||
|
start when command stack is holding than 16.
|
||||||
|
|
||||||
|
* Translations for German comments provided by Dietmar Warning, to fix
|
||||||
|
issue with UTF-8 observed on Windows (src/main.c)
|
||||||
|
|
||||||
|
* Fixed readline operation within ngnutmeg (src/main.c). Also include some
|
||||||
|
minor tidy-up to avoid some compiler warnings. Updated copyright date
|
||||||
|
for --help.
|
||||||
|
|
||||||
2005-04-29 Paolo Nenzi <p.nenzi@ieee.org>
|
2005-04-29 Paolo Nenzi <p.nenzi@ieee.org>
|
||||||
|
|
||||||
* src/frontend/inpcom.c: end-of-line comments starting with
|
* src/frontend/inpcom.c: end-of-line comments starting with
|
||||||
|
|
|
||||||
89
src/main.c
89
src/main.c
|
|
@ -78,7 +78,7 @@ bool ft_intrpt = FALSE; /* Set by the (void) signal handlers. TRUE = we've b
|
||||||
bool ft_setflag = FALSE; /* TRUE = Don't abort simulation after an interrupt. */
|
bool ft_setflag = FALSE; /* TRUE = Don't abort simulation after an interrupt. */
|
||||||
char *ft_rawfile = "rawspice.raw";
|
char *ft_rawfile = "rawspice.raw";
|
||||||
|
|
||||||
bool oflag = FALSE; /* Output über redefinierte Funktionen */
|
bool oflag = FALSE; /* Output over redefined I/O functions */
|
||||||
FILE *flogp; /* hvogt 15.12.2001 */
|
FILE *flogp; /* hvogt 15.12.2001 */
|
||||||
|
|
||||||
/* Frontend and circuit options */
|
/* Frontend and circuit options */
|
||||||
|
|
@ -120,8 +120,6 @@ BOOLEAN TWOtranDebug = TRUE;
|
||||||
BOOLEAN TWOjacDebug = FALSE;
|
BOOLEAN TWOjacDebug = FALSE;
|
||||||
|
|
||||||
/* CIDER Global Variable Declarations */
|
/* CIDER Global Variable Declarations */
|
||||||
|
|
||||||
char *LogFileName = "cider.log"; /* This will go somewhere else */
|
|
||||||
|
|
||||||
int BandGapNarrowing;
|
int BandGapNarrowing;
|
||||||
int TempDepMobility, ConcDepMobility, FieldDepMobility, TransDepMobility;
|
int TempDepMobility, ConcDepMobility, FieldDepMobility, TransDepMobility;
|
||||||
|
|
@ -152,18 +150,16 @@ static int started = FALSE;
|
||||||
/* static functions */
|
/* static functions */
|
||||||
static int SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator);
|
static int SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator);
|
||||||
static int shutdown(int exitval);
|
static int shutdown(int exitval);
|
||||||
|
static void app_rl_readlines(void);
|
||||||
#ifdef HAVE_GNUREADLINE
|
#ifdef HAVE_GNUREADLINE
|
||||||
static char * prompt();
|
static char * prompt(void);
|
||||||
|
static int rl_event_func(void) ;
|
||||||
#endif /* HAVE_GNUREADLINE */
|
#endif /* HAVE_GNUREADLINE */
|
||||||
static void show_help(void);
|
static void show_help(void);
|
||||||
static void show_version(void);
|
static void show_version(void);
|
||||||
static bool read_initialisation_file(char * dir, char * name);
|
static bool read_initialisation_file(char * dir, char * name);
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
static void append_to_stream(FILE *dest, FILE *source);
|
static void append_to_stream(FILE *dest, FILE *source);
|
||||||
#ifdef HAVE_GNUREADLINE
|
|
||||||
static int rl_event_func() ;
|
|
||||||
static void app_rl_readlines();
|
|
||||||
#endif /* HAVE_GNUREADLINE */
|
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -357,19 +353,20 @@ shutdown(int exitval)
|
||||||
#ifdef HAVE_GNUREADLINE
|
#ifdef HAVE_GNUREADLINE
|
||||||
/* Adapted ../lib/cp/lexical.c:prompt() for GNU Readline -- Andrew Veliath <veliaa@rpi.edu> */
|
/* Adapted ../lib/cp/lexical.c:prompt() for GNU Readline -- Andrew Veliath <veliaa@rpi.edu> */
|
||||||
static char *
|
static char *
|
||||||
prompt()
|
prompt(void)
|
||||||
{
|
{
|
||||||
static char pbuf[128];
|
static char pbuf[128];
|
||||||
char *p = pbuf, *s;
|
char *p = pbuf, *s;
|
||||||
|
|
||||||
if (cp_interactive == FALSE)
|
if (cp_interactive == FALSE)
|
||||||
return NULL; /* NULL means no prompt */
|
return NULL; /* NULL means no prompt */
|
||||||
if (cp_promptstring == NULL)
|
|
||||||
s = "-> ";
|
s = get_alt_prompt();
|
||||||
else
|
if(s==NULL)
|
||||||
s = cp_promptstring;
|
s = cp_promptstring;
|
||||||
if (cp_altprompt)
|
if(s==NULL)
|
||||||
s = cp_altprompt;
|
s = "->";
|
||||||
|
|
||||||
while (*s) {
|
while (*s) {
|
||||||
switch (strip(*s)) {
|
switch (strip(*s)) {
|
||||||
case '!':
|
case '!':
|
||||||
|
|
@ -388,7 +385,6 @@ prompt()
|
||||||
return pbuf;
|
return pbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* Process device events in Readline's hook since there is no where
|
/* Process device events in Readline's hook since there is no where
|
||||||
else to do it now - AV */
|
else to do it now - AV */
|
||||||
|
|
@ -400,13 +396,35 @@ rl_event_func()
|
||||||
Input(&reqst, NULL);
|
Input(&reqst, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_GNUREADLINE */
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* Added GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */
|
/* This is the command processing loop for spice and nutmeg.
|
||||||
|
The function is called even when GNU readline is unavailable, in which
|
||||||
|
case it falls back to repeatable calling cp_evloop()
|
||||||
|
SJB 26th April 2005 */
|
||||||
static void
|
static void
|
||||||
app_rl_readlines()
|
app_rl_readlines()
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_GNUREADLINE
|
||||||
|
/* GNU Readline Support -- Andrew Veliath <veliaa@rpi.edu> */
|
||||||
char *line, *expanded_line;
|
char *line, *expanded_line;
|
||||||
|
|
||||||
|
/* --- set up readline params --- */
|
||||||
|
strcpy(gnu_history_file, getenv("HOME"));
|
||||||
|
strcat(gnu_history_file, "/.");
|
||||||
|
strcat(gnu_history_file, application_name);
|
||||||
|
strcat(gnu_history_file, "_history");
|
||||||
|
|
||||||
|
using_history();
|
||||||
|
read_history(gnu_history_file);
|
||||||
|
|
||||||
|
rl_readline_name = application_name;
|
||||||
|
rl_instream = cp_in;
|
||||||
|
rl_outstream = cp_out;
|
||||||
|
rl_event_hook = rl_event_func;
|
||||||
|
rl_catch_signals = 0; /* disable readline signal handling */
|
||||||
|
rl_catch_sigwinch = 1; /* allow readline to respond to resized windows */
|
||||||
|
|
||||||
/* note that we want some mechanism to detect ctrl-D and expand it to exit */
|
/* note that we want some mechanism to detect ctrl-D and expand it to exit */
|
||||||
while (1) {
|
while (1) {
|
||||||
|
|
@ -431,9 +449,11 @@ app_rl_readlines()
|
||||||
if (line) free(line);
|
if (line) free(line);
|
||||||
}
|
}
|
||||||
/* History gets written in ../fte/misccoms.c com_quit */
|
/* History gets written in ../fte/misccoms.c com_quit */
|
||||||
|
|
||||||
|
#else
|
||||||
|
while (cp_evloop((char *) NULL) == 1) ;
|
||||||
|
#endif /* ifelse HAVE_GNUREADLINE */
|
||||||
}
|
}
|
||||||
#endif /* SIMULATOR */
|
|
||||||
#endif /* HAVE_GNUREADLINE */
|
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
@ -467,7 +487,7 @@ show_version(void)
|
||||||
"Currently maintained by the NGSpice Project\n\n"
|
"Currently maintained by the NGSpice Project\n\n"
|
||||||
"Copyright (C) 1985-1996,"
|
"Copyright (C) 1985-1996,"
|
||||||
" The Regents of the University of California\n"
|
" The Regents of the University of California\n"
|
||||||
"Copyright (C) 1999-2000,"
|
"Copyright (C) 1999-2005,"
|
||||||
" The NGSpice Project\n", cp_program, PACKAGE, VERSION);
|
" The NGSpice Project\n", cp_program, PACKAGE, VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -737,7 +757,7 @@ main(int argc, char **argv)
|
||||||
shutdown (EXIT_BAD);
|
shutdown (EXIT_BAD);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* *** Log-File öffnen ******* */
|
/* *** Open the Log-File ******* */
|
||||||
if (!(flogp = fopen(buf, "w"))) {
|
if (!(flogp = fopen(buf, "w"))) {
|
||||||
perror(buf);
|
perror(buf);
|
||||||
shutdown(EXIT_BAD);
|
shutdown(EXIT_BAD);
|
||||||
|
|
@ -986,30 +1006,7 @@ evl:
|
||||||
} /* --- if (ft_batchmode) --- */
|
} /* --- if (ft_batchmode) --- */
|
||||||
else {
|
else {
|
||||||
cp_interactive = TRUE;
|
cp_interactive = TRUE;
|
||||||
|
app_rl_readlines(); /* enter the command processing loop */
|
||||||
#ifdef HAVE_GNUREADLINE
|
|
||||||
/* --- set up readline params --- */
|
|
||||||
strcpy(gnu_history_file, getenv("HOME"));
|
|
||||||
strcat(gnu_history_file, "/.");
|
|
||||||
strcat(gnu_history_file, application_name);
|
|
||||||
strcat(gnu_history_file, "_history");
|
|
||||||
|
|
||||||
using_history();
|
|
||||||
read_history(gnu_history_file);
|
|
||||||
|
|
||||||
rl_readline_name = application_name;
|
|
||||||
rl_instream = cp_in;
|
|
||||||
rl_outstream = cp_out;
|
|
||||||
rl_event_hook = rl_event_func;
|
|
||||||
rl_catch_signals = 0; /* disable readline signal handling */
|
|
||||||
rl_catch_sigwinch = 1; /* allow readline to respond to resized windows */
|
|
||||||
|
|
||||||
/* Here's where we enter the command processing loop */
|
|
||||||
app_rl_readlines();
|
|
||||||
#else
|
|
||||||
while (cp_evloop((char *) NULL) == 1) ;
|
|
||||||
#endif /* ifelse HAVE_GNUREADLINE */
|
|
||||||
|
|
||||||
} /* --- else (if (ft_batchmode)) --- */
|
} /* --- else (if (ft_batchmode)) --- */
|
||||||
|
|
||||||
#else /* ~ SIMULATOR */
|
#else /* ~ SIMULATOR */
|
||||||
|
|
@ -1027,7 +1024,7 @@ evl:
|
||||||
/* Nutmeg "main" */
|
/* Nutmeg "main" */
|
||||||
(void) sigsetjmp(jbuf, 1);
|
(void) sigsetjmp(jbuf, 1);
|
||||||
cp_interactive = TRUE;
|
cp_interactive = TRUE;
|
||||||
while (cp_evloop((char *) NULL) == 1) ;
|
app_rl_readlines(); /* enter the command processing loop */
|
||||||
|
|
||||||
#endif /* ~ SIMULATOR */
|
#endif /* ~ SIMULATOR */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue