misccoms.c, indentation and whitespace cleanup
This commit is contained in:
parent
215809b99f
commit
5f3b453a30
|
|
@ -1,6 +1,6 @@
|
||||||
/**********
|
/**********
|
||||||
Copyright 1990 Regents of the University of California. All rights reserved.
|
Copyright 1990 Regents of the University of California. All rights reserved.
|
||||||
Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
|
Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
|
||||||
**********/
|
**********/
|
||||||
|
|
||||||
#include "ngspice/ngspice.h"
|
#include "ngspice/ngspice.h"
|
||||||
|
|
@ -18,17 +18,17 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
|
||||||
#include <readline/readline.h>
|
#include <readline/readline.h>
|
||||||
#include <readline/history.h>
|
#include <readline/history.h>
|
||||||
extern char history_file[];
|
extern char history_file[];
|
||||||
#endif /* HAVE_GNUREADLINE */
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_BSDEDITLINE
|
#ifdef HAVE_BSDEDITLINE
|
||||||
/* SJB added edit line support 2005-05-05 */
|
|
||||||
#include <editline/readline.h>
|
#include <editline/readline.h>
|
||||||
extern char history_file[];
|
extern char history_file[];
|
||||||
#endif /* HAVE_BSDEDITLINE */
|
#endif
|
||||||
|
|
||||||
extern IFsimulator SIMinfo;
|
extern IFsimulator SIMinfo;
|
||||||
static void byemesg(void);
|
static void byemesg(void);
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
com_quit(wordlist *wl)
|
com_quit(wordlist *wl)
|
||||||
{
|
{
|
||||||
|
|
@ -39,15 +39,16 @@ com_quit(wordlist *wl)
|
||||||
bool noask;
|
bool noask;
|
||||||
|
|
||||||
noask = cp_getvar("noaskquit", CP_BOOL, NULL);
|
noask = cp_getvar("noaskquit", CP_BOOL, NULL);
|
||||||
|
|
||||||
gr_clean();
|
gr_clean();
|
||||||
cp_ccon(FALSE);
|
cp_ccon(FALSE);
|
||||||
|
|
||||||
if(wl)
|
if(wl)
|
||||||
if(wl->wl_word)
|
if(wl->wl_word)
|
||||||
if(cieq(wl->wl_word,"noask"))
|
if(cieq(wl->wl_word, "noask")) {
|
||||||
{
|
byemesg();
|
||||||
byemesg();
|
exit(EXIT_NORMAL);
|
||||||
exit(EXIT_NORMAL);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure the guy really wants to quit. */
|
/* Make sure the guy really wants to quit. */
|
||||||
if (!ft_nutmeg && !noask) {
|
if (!ft_nutmeg && !noask) {
|
||||||
|
|
@ -60,42 +61,42 @@ com_quit(wordlist *wl)
|
||||||
if (ncc || npl) {
|
if (ncc || npl) {
|
||||||
fprintf(cp_out, "Warning: ");
|
fprintf(cp_out, "Warning: ");
|
||||||
if (ncc) {
|
if (ncc) {
|
||||||
fprintf(cp_out,
|
fprintf(cp_out,
|
||||||
"the following simulation%s still in progress:\n",
|
"the following simulation%s still in progress:\n",
|
||||||
(ncc > 1) ? "s are" : " is");
|
(ncc > 1) ? "s are" : " is");
|
||||||
for (cc = ft_circuits; cc; cc = cc->ci_next)
|
for (cc = ft_circuits; cc; cc = cc->ci_next)
|
||||||
if (cc->ci_inprogress)
|
if (cc->ci_inprogress)
|
||||||
fprintf(cp_out, "\t%s\n",
|
fprintf(cp_out, "\t%s\n", cc->ci_name);
|
||||||
cc->ci_name);
|
|
||||||
}
|
}
|
||||||
if (npl) {
|
if (npl) {
|
||||||
if (ncc)
|
if (ncc)
|
||||||
fprintf(cp_out, "and ");
|
fprintf(cp_out, "and ");
|
||||||
fprintf(cp_out,
|
fprintf(cp_out,
|
||||||
"the following plot%s been saved:\n",
|
"the following plot%s been saved:\n",
|
||||||
(npl > 1) ? "s haven't" : " hasn't");
|
(npl > 1) ? "s haven't" : " hasn't");
|
||||||
for (pl = plot_list; pl; pl = pl->pl_next)
|
for (pl = plot_list; pl; pl = pl->pl_next)
|
||||||
if (!pl->pl_written && pl->pl_dvecs)
|
if (!pl->pl_written && pl->pl_dvecs)
|
||||||
fprintf(cp_out, "%s\t%s, %s\n",
|
fprintf(cp_out, "%s\t%s, %s\n",
|
||||||
pl->pl_typename,
|
pl->pl_typename, pl->pl_title, pl->pl_name);
|
||||||
pl->pl_title,
|
|
||||||
pl->pl_name);
|
|
||||||
}
|
}
|
||||||
fprintf(cp_out,
|
|
||||||
"\nAre you sure you want to quit (yes)? ");
|
fprintf(cp_out, "\nAre you sure you want to quit (yes)? ");
|
||||||
(void) fflush(cp_out);
|
(void) fflush(cp_out);
|
||||||
|
|
||||||
if (!fgets(buf, sizeof(buf), stdin)) {
|
if (!fgets(buf, sizeof(buf), stdin)) {
|
||||||
clearerr(stdin);
|
clearerr(stdin);
|
||||||
*buf = 'y';
|
*buf = 'y';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*buf == 'y') || (*buf == 'Y') || (*buf == '\n')) {
|
if ((*buf == 'y') || (*buf == 'Y') || (*buf == '\n')) {
|
||||||
#ifdef EXPERIMENTAL_CODE
|
#ifdef EXPERIMENTAL_CODE
|
||||||
/* Destroy CKT when quit. Add by Gong Ding, gdiso@ustc.edu */
|
/* Destroy CKT when quit. Add by Gong Ding, gdiso@ustc.edu */
|
||||||
for (cc = ft_circuits; cc; cc = cc->ci_next)
|
for (cc = ft_circuits; cc; cc = cc->ci_next)
|
||||||
if(SIMinfo.deleteCircuit) SIMinfo.deleteCircuit(cc->ci_ckt);
|
if(SIMinfo.deleteCircuit)
|
||||||
|
SIMinfo.deleteCircuit(cc->ci_ckt);
|
||||||
#endif
|
#endif
|
||||||
byemesg();
|
byemesg();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -105,7 +106,6 @@ com_quit(wordlist *wl)
|
||||||
byemesg();
|
byemesg();
|
||||||
|
|
||||||
exit(EXIT_NORMAL);
|
exit(EXIT_NORMAL);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -120,24 +120,25 @@ com_bug(wordlist *wl)
|
||||||
|
|
||||||
if (!Bug_Addr || !*Bug_Addr) {
|
if (!Bug_Addr || !*Bug_Addr) {
|
||||||
fprintf(cp_err, "Error: No address to send bug reports to.\n");
|
fprintf(cp_err, "Error: No address to send bug reports to.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(cp_out, "Calling the mail program . . .(sending to %s)\n\n",
|
fprintf(cp_out, "Calling the mail program . . .(sending to %s)\n\n",
|
||||||
Bug_Addr);
|
Bug_Addr);
|
||||||
fprintf(cp_out,
|
fprintf(cp_out,
|
||||||
"Please include the OS version number and machine architecture.\n");
|
"Please include the OS version number and machine architecture.\n");
|
||||||
fprintf(cp_out,
|
fprintf(cp_out,
|
||||||
"If the problem is with a specific circuit, please include the\n");
|
"If the problem is with a specific circuit, please include the\n");
|
||||||
fprintf(cp_out, "input file.\n");
|
fprintf(cp_out, "input file.\n");
|
||||||
|
|
||||||
(void) sprintf(buf, SYSTEM_MAIL, ft_sim->simulator,
|
(void) sprintf(buf, SYSTEM_MAIL, ft_sim->simulator,
|
||||||
ft_sim->version, Bug_Addr);
|
ft_sim->version, Bug_Addr);
|
||||||
(void) system(buf);
|
(void) system(buf);
|
||||||
|
|
||||||
fprintf(cp_out, "Bug report sent. Thank you.\n");
|
fprintf(cp_out, "Bug report sent. Thank you.\n");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* SYSTEM_MAIL */
|
#else
|
||||||
|
|
||||||
void
|
void
|
||||||
com_bug(wordlist *wl)
|
com_bug(wordlist *wl)
|
||||||
|
|
@ -146,118 +147,128 @@ com_bug(wordlist *wl)
|
||||||
|
|
||||||
fprintf(cp_out, "Please use the ngspice bug tracker at:\n");
|
fprintf(cp_out, "Please use the ngspice bug tracker at:\n");
|
||||||
fprintf(cp_out, "http://sourceforge.net/tracker/?group_id=38962&atid=423915\n");
|
fprintf(cp_out, "http://sourceforge.net/tracker/?group_id=38962&atid=423915\n");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SYSTEM_MAIL */
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* printout upon startup or 'version' command. options to version are -s (short)
|
/* printout upon startup or 'version' command. options to version are -s (short)
|
||||||
or -f (full). 'version' with options may also be used in ngspice pipe mode. */
|
or -f (full). 'version' with options may also be used in ngspice pipe mode. */
|
||||||
|
|
||||||
void
|
void
|
||||||
com_version(wordlist *wl)
|
com_version(wordlist *wl)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (!wl) {
|
if (!wl) {
|
||||||
/* no printout in pipe mode (-p) */
|
|
||||||
if (ft_pipemode) return;
|
|
||||||
fprintf(cp_out, "******\n");
|
|
||||||
|
|
||||||
fprintf(cp_out, "** %s-%s : %s\n", ft_sim->simulator,
|
/* no printout in pipe mode (-p) */
|
||||||
ft_sim->version, ft_sim->description);
|
if (ft_pipemode)
|
||||||
fprintf(cp_out, "** The U. C. Berkeley CAD Group\n");
|
return;
|
||||||
fprintf(cp_out,
|
|
||||||
"** Copyright 1985-1994, Regents of the University of California.\n");
|
fprintf(cp_out, "******\n");
|
||||||
fprintf(cp_out, "** %s\n", Spice_Manual);
|
fprintf(cp_out, "** %s-%s : %s\n", ft_sim->simulator,
|
||||||
if (Spice_Notice != NULL && *Spice_Notice != 0)
|
ft_sim->version, ft_sim->description);
|
||||||
fprintf(cp_out, "** %s\n", Spice_Notice);
|
fprintf(cp_out, "** The U. C. Berkeley CAD Group\n");
|
||||||
if (Spice_Build_Date != NULL && *Spice_Build_Date != 0)
|
fprintf(cp_out,
|
||||||
fprintf(cp_out, "** Creation Date: %s\n", Spice_Build_Date);
|
"** Copyright 1985-1994, Regents of the University of California.\n");
|
||||||
fprintf(cp_out, "******\n");
|
fprintf(cp_out, "** %s\n", Spice_Manual);
|
||||||
|
if (Spice_Notice != NULL && *Spice_Notice != 0)
|
||||||
|
fprintf(cp_out, "** %s\n", Spice_Notice);
|
||||||
|
if (Spice_Build_Date != NULL && *Spice_Build_Date != 0)
|
||||||
|
fprintf(cp_out, "** Creation Date: %s\n", Spice_Build_Date);
|
||||||
|
fprintf(cp_out, "******\n");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
s = wl_flatten(wl);
|
|
||||||
if (!strncmp(s, "-s", 2) || !strncmp(s, "-S", 2) ) {
|
|
||||||
fprintf(cp_out, "******\n");
|
|
||||||
fprintf(cp_out, "** %s-%s\n", ft_sim->simulator,
|
|
||||||
ft_sim->version);
|
|
||||||
fprintf(cp_out, "** %s\n", Spice_Manual);
|
|
||||||
if (Spice_Notice != NULL && *Spice_Notice != 0)
|
|
||||||
fprintf(cp_out, "** %s\n", Spice_Notice);
|
|
||||||
if (Spice_Build_Date != NULL && *Spice_Build_Date != 0)
|
|
||||||
fprintf(cp_out, "** Creation Date: %s\n", Spice_Build_Date);
|
|
||||||
fprintf(cp_out, "******\n");
|
|
||||||
} else if (!strncmp(s, "-f", 2) || !strncmp(s, "-F", 2) ) {
|
|
||||||
|
|
||||||
fprintf(cp_out, "******\n");
|
|
||||||
|
|
||||||
fprintf(cp_out, "** %s-%s : %s\n", ft_sim->simulator,
|
s = wl_flatten(wl);
|
||||||
ft_sim->version, ft_sim->description);
|
|
||||||
fprintf(cp_out, "** The U. C. Berkeley CAD Group\n");
|
if (!strncmp(s, "-s", 2) || !strncmp(s, "-S", 2) ) {
|
||||||
fprintf(cp_out,
|
|
||||||
"** Copyright 1985-1994, Regents of the University of California.\n");
|
fprintf(cp_out, "******\n");
|
||||||
fprintf(cp_out, "** %s\n", Spice_Manual);
|
fprintf(cp_out, "** %s-%s\n", ft_sim->simulator,
|
||||||
if (Spice_Notice != NULL && *Spice_Notice != 0)
|
ft_sim->version);
|
||||||
fprintf(cp_out, "** %s\n", Spice_Notice);
|
fprintf(cp_out, "** %s\n", Spice_Manual);
|
||||||
if (Spice_Build_Date != NULL && *Spice_Build_Date != 0)
|
if (Spice_Notice != NULL && *Spice_Notice != 0)
|
||||||
fprintf(cp_out, "** Creation Date: %s\n", Spice_Build_Date);
|
fprintf(cp_out, "** %s\n", Spice_Notice);
|
||||||
fprintf(cp_out,"**\n");
|
if (Spice_Build_Date != NULL && *Spice_Build_Date != 0)
|
||||||
|
fprintf(cp_out, "** Creation Date: %s\n", Spice_Build_Date);
|
||||||
|
fprintf(cp_out, "******\n");
|
||||||
|
|
||||||
|
} else if (!strncmp(s, "-f", 2) || !strncmp(s, "-F", 2) ) {
|
||||||
|
|
||||||
|
fprintf(cp_out, "******\n");
|
||||||
|
|
||||||
|
fprintf(cp_out, "** %s-%s : %s\n", ft_sim->simulator,
|
||||||
|
ft_sim->version, ft_sim->description);
|
||||||
|
fprintf(cp_out, "** The U. C. Berkeley CAD Group\n");
|
||||||
|
fprintf(cp_out,
|
||||||
|
"** Copyright 1985-1994, Regents of the University of California.\n");
|
||||||
|
fprintf(cp_out, "** %s\n", Spice_Manual);
|
||||||
|
if (Spice_Notice != NULL && *Spice_Notice != 0)
|
||||||
|
fprintf(cp_out, "** %s\n", Spice_Notice);
|
||||||
|
if (Spice_Build_Date != NULL && *Spice_Build_Date != 0)
|
||||||
|
fprintf(cp_out, "** Creation Date: %s\n", Spice_Build_Date);
|
||||||
|
fprintf(cp_out, "**\n");
|
||||||
#ifdef CIDER
|
#ifdef CIDER
|
||||||
fprintf(cp_out,"** CIDER 1.b1 (CODECS simulator) included\n");
|
fprintf(cp_out, "** CIDER 1.b1 (CODECS simulator) included\n");
|
||||||
#endif
|
|
||||||
#ifdef XSPICE
|
|
||||||
fprintf(cp_out,"** XSPICE extensions included\n");
|
|
||||||
#endif
|
#endif
|
||||||
fprintf(cp_out,"** Relevant compilation options (refer to user's manual):\n");
|
#ifdef XSPICE
|
||||||
|
fprintf(cp_out, "** XSPICE extensions included\n");
|
||||||
|
#endif
|
||||||
|
fprintf(cp_out, "** Relevant compilation options (refer to user's manual):\n");
|
||||||
#ifdef NGDEBUG
|
#ifdef NGDEBUG
|
||||||
fprintf(cp_out,"** Debugging option (-g) enabled\n");
|
fprintf(cp_out, "** Debugging option (-g) enabled\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef ADMS
|
#ifdef ADMS
|
||||||
fprintf(cp_out,"** Adms interface enabled\n");
|
fprintf(cp_out, "** Adms interface enabled\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_OMP
|
#ifdef USE_OMP
|
||||||
fprintf(cp_out,"** OpenMP multithreading for BSIM3, BSIM4 enabled\n");
|
fprintf(cp_out, "** OpenMP multithreading for BSIM3, BSIM4 enabled\n");
|
||||||
#endif
|
#endif
|
||||||
#if defined(X_DISPLAY_MISSING) && !defined(HAS_WINDOWS)
|
#if defined(X_DISPLAY_MISSING) && !defined(HAS_WINDOWS)
|
||||||
fprintf(cp_out,"** X11 interface not compiled into ngspice\n");
|
fprintf(cp_out, "** X11 interface not compiled into ngspice\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef NOBYPASS
|
#ifdef NOBYPASS
|
||||||
fprintf(cp_out,"** --enable-nobypass\n");
|
fprintf(cp_out, "** --enable-nobypass\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef CAPBYPASS
|
#ifdef CAPBYPASS
|
||||||
fprintf(cp_out,"** --enable-capbypass\n");
|
fprintf(cp_out, "** --enable-capbypass\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef NODELIMITING
|
#ifdef NODELIMITING
|
||||||
fprintf(cp_out,"** --enable-nodelimiting\n");
|
fprintf(cp_out, "** --enable-nodelimiting\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef PREDICTOR
|
#ifdef PREDICTOR
|
||||||
fprintf(cp_out,"** --enable-predictor\n");
|
fprintf(cp_out, "** --enable-predictor\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef NEWTRUNC
|
#ifdef NEWTRUNC
|
||||||
fprintf(cp_out,"** --enable-newtrunc\n");
|
fprintf(cp_out, "** --enable-newtrunc\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef WANT_SENSE2
|
#ifdef WANT_SENSE2
|
||||||
fprintf(cp_out,"** --enable-sense2\n");
|
fprintf(cp_out, "** --enable-sense2\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(cp_out,"**\n");
|
fprintf(cp_out, "**\n");
|
||||||
#ifdef EXPERIMENTAL_CODE
|
#ifdef EXPERIMENTAL_CODE
|
||||||
fprintf(cp_out,"** Experimental code enabled.\n");
|
fprintf(cp_out, "** Experimental code enabled.\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef EXP_DEV
|
#ifdef EXP_DEV
|
||||||
fprintf(cp_out,"** Experimental devices enabled.\n");
|
fprintf(cp_out, "** Experimental devices enabled.\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(cp_out, "******\n");
|
fprintf(cp_out, "******\n");
|
||||||
|
|
||||||
} else if (!eq(ft_sim->version, s)) {
|
} else if (!eq(ft_sim->version, s)) {
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Note: rawfile is version %s (current version is %s)\n",
|
"Note: rawfile is version %s (current version is %s)\n",
|
||||||
wl->wl_word, ft_sim->version);
|
wl->wl_word, ft_sim->version);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tfree(s);
|
tfree(s);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
byemesg(void)
|
byemesg(void)
|
||||||
{
|
{
|
||||||
|
|
@ -265,11 +276,10 @@ byemesg(void)
|
||||||
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
|
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
|
||||||
/* write out command history only when saying goodbye. */
|
/* write out command history only when saying goodbye. */
|
||||||
if (cp_interactive && (cp_maxhistlength > 0)) {
|
if (cp_interactive && (cp_maxhistlength > 0)) {
|
||||||
stifle_history(cp_maxhistlength);
|
stifle_history(cp_maxhistlength);
|
||||||
write_history(history_file);
|
write_history(history_file);
|
||||||
}
|
}
|
||||||
#endif /* defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) */
|
#endif
|
||||||
|
|
||||||
printf("%s-%s done\n", ft_sim->simulator, ft_sim->version);
|
printf("%s-%s done\n", ft_sim->simulator, ft_sim->version);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue