ngspice/src/frontend/runcoms.c

394 lines
9.6 KiB
C
Raw Normal View History

2000-04-27 22:03:57 +02:00
/**********
Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
Modified: 2000 AlansFixes
$Id$
2000-04-27 22:03:57 +02:00
**********/
/*
* Circuit simulation commands.
*/
#include "ngspice.h"
#include "cpdefs.h"
#include "ftedefs.h"
#include "ftedev.h"
#include "ftedebug.h"
* src/Makefile.am src/main.c src/sconvert.c src/analysis/cktdisto.c src/analysis/cktnoise.c src/analysis/noisean.c: Updates for the new header files. * src/maths/cmaths/cmath1.c src/maths/cmaths/cmath2.c src/maths/cmaths/cmath3.c src/maths/cmaths/cmath4.c: Updates for the new header files. * src/frontend/.cvsignore src/frontend/Makefile.am: Updates for the new files. * src/frontend/agraf.c src/frontend/aspice.c src/frontend/breakp.c src/frontend/breakp2.c src/frontend/circuits.c src/frontend/cpitf.c src/frontend/debugcom.c src/frontend/define.c src/frontend/diff.c src/frontend/dimens.c src/frontend/display.c src/frontend/doplot.c src/frontend/dotcards.c src/frontend/evaluate.c src/frontend/fourier.c src/frontend/graf.c src/frontend/grid.c src/frontend/inp.c src/frontend/inpcom.c src/frontend/interp.c src/frontend/linear.c src/frontend/misccoms.c src/frontend/misccoms.h src/frontend/miscvars.c src/frontend/mw_coms.c src/frontend/newcoms.c src/frontend/nutinp.c src/frontend/options.c src/frontend/outitf.c src/frontend/parse.c src/frontend/plotcurv.c src/frontend/points.c src/frontend/postcoms.c src/frontend/rawfile.c src/frontend/runcoms.c src/frontend/runcoms2.c src/frontend/shyu.c src/frontend/spec.c src/frontend/spiceif.c src/frontend/typesdef.c src/frontend/vectors.c src/frontend/where.c src/frontend/postcoms.c: Updates for the new header files. Some commands have moved into the new files below. * src/frontend/README src/frontend/com_compose.c src/frontend/com_compose.h src/frontend/com_display.c src/frontend/com_display.h src/frontend/com_let.c src/frontend/com_let.h src/frontend/com_setscale.c src/frontend/com_setscale.h src/frontend/commands.c src/frontend/commands.h src/frontend/completion.h src/frontend/streams.h src/frontend/testcommands.c: Separation into different com_* commands. This is a start. The rest of the subdirectory needs doing. * src/include/complex.h src/include/cpdefs.h src/include/cpextern.h src/include/cpstd.h src/include/fteconst.h src/include/ftedata.h src/include/ftedev.h src/include/fteext.h src/include/ftegraph.h src/include/fteparse.h src/include/dvec.h src/include/grid.h src/include/plot.h src/include/pnode.h src/include/sim.h src/include/variable.h src/include/wordlist.h src/include/bool.h: Separation of header files into smaller pieces. This limits recompilation to only the affected source files. The original header files have a warning message embedded to flag obsoleted use. * src/frontend/compose.c src/frontend/compose.h src/frontend/nutctab.c src/frontend/nutctab.h src/frontend/plot5.c src/frontend/plot5.h src/frontend/spcmdtab.c src/frontend/x11.c src/frontend/x11.h src/frontend/xgraph.c src/frontend/xgraph.h: Moved these files into src/frontend/plotting subdirectory. * src/frontend/plotting/.cvsignore src/frontend/plotting/Makefile.am src/frontend/plotting/plot5.c src/frontend/plotting/plot5.h src/frontend/plotting/plotting.c src/frontend/plotting/plotting.h src/frontend/plotting/pvec.c src/frontend/plotting/pvec.h src/frontend/plotting/x11.c src/frontend/plotting/x11.h src/frontend/plotting/xgraph.c src/frontend/plotting/xgraph.h: The new libplotting library with automake and CVS infrastructure.
2000-05-06 16:12:51 +02:00
#include "dvec.h"
2000-04-27 22:03:57 +02:00
src/Makefile.am src/help.c src/main.c src/circuit/Makefile.am src/circuit/ifnewuid.c src/frontend/Makefile.am src/frontend/aspice.c src/frontend/circuits.h src/frontend/com_display.c src/frontend/com_hardcopy.c src/frontend/commands.c src/frontend/commands.h src/frontend/cpitf.c src/frontend/debugcom.c src/frontend/device.c src/frontend/diff.c src/frontend/display.c src/frontend/dotcards.c src/frontend/fourier.c src/frontend/inp.c src/frontend/inpcom.c src/frontend/linear.c src/frontend/misccoms.c src/frontend/mw_coms.c src/frontend/nutinp.c src/frontend/options.c src/frontend/outitf.c src/frontend/parse.c src/frontend/postcoms.c src/frontend/postsc.c src/frontend/rawfile.c src/frontend/resource.c src/frontend/runcoms.c src/frontend/runcoms2.c src/frontend/shyu.c src/frontend/spec.c src/frontend/spiceif.c src/frontend/subckt.c src/frontend/vectors.c src/frontend/where.c src/frontend/plotting/Makefile.am src/frontend/plotting/agraf.c src/frontend/plotting/graf.c src/frontend/plotting/plotcurv.c src/frontend/plotting/plotit.c src/frontend/plotting/x11.c src/frontend/plotting/xgraph.c src/include/Makefile.am src/maths/cmaths/cmath4.c src/misc/terminal.c src/misc/terminal.h src/parser/cshpar.c src/parser/front.c src/parser/front.h src/parser/history.c src/parser/history.h src/parser/modify.c src/parser/var2.c src/parser/var2.h src/parser/variable.c: Refactoring of frontend code. * src/include/ftehelp.h src/include/variable.h: Moved into frontend directory. * src/include/cpdefs.h src/include/cpextern.h src/include/ftedefs.h src/include/plot.h: Updates.
2000-06-27 18:09:02 +02:00
#include "circuits.h"
* src/Makefile.am src/main.c src/sconvert.c src/analysis/cktdisto.c src/analysis/cktnoise.c src/analysis/noisean.c: Updates for the new header files. * src/maths/cmaths/cmath1.c src/maths/cmaths/cmath2.c src/maths/cmaths/cmath3.c src/maths/cmaths/cmath4.c: Updates for the new header files. * src/frontend/.cvsignore src/frontend/Makefile.am: Updates for the new files. * src/frontend/agraf.c src/frontend/aspice.c src/frontend/breakp.c src/frontend/breakp2.c src/frontend/circuits.c src/frontend/cpitf.c src/frontend/debugcom.c src/frontend/define.c src/frontend/diff.c src/frontend/dimens.c src/frontend/display.c src/frontend/doplot.c src/frontend/dotcards.c src/frontend/evaluate.c src/frontend/fourier.c src/frontend/graf.c src/frontend/grid.c src/frontend/inp.c src/frontend/inpcom.c src/frontend/interp.c src/frontend/linear.c src/frontend/misccoms.c src/frontend/misccoms.h src/frontend/miscvars.c src/frontend/mw_coms.c src/frontend/newcoms.c src/frontend/nutinp.c src/frontend/options.c src/frontend/outitf.c src/frontend/parse.c src/frontend/plotcurv.c src/frontend/points.c src/frontend/postcoms.c src/frontend/rawfile.c src/frontend/runcoms.c src/frontend/runcoms2.c src/frontend/shyu.c src/frontend/spec.c src/frontend/spiceif.c src/frontend/typesdef.c src/frontend/vectors.c src/frontend/where.c src/frontend/postcoms.c: Updates for the new header files. Some commands have moved into the new files below. * src/frontend/README src/frontend/com_compose.c src/frontend/com_compose.h src/frontend/com_display.c src/frontend/com_display.h src/frontend/com_let.c src/frontend/com_let.h src/frontend/com_setscale.c src/frontend/com_setscale.h src/frontend/commands.c src/frontend/commands.h src/frontend/completion.h src/frontend/streams.h src/frontend/testcommands.c: Separation into different com_* commands. This is a start. The rest of the subdirectory needs doing. * src/include/complex.h src/include/cpdefs.h src/include/cpextern.h src/include/cpstd.h src/include/fteconst.h src/include/ftedata.h src/include/ftedev.h src/include/fteext.h src/include/ftegraph.h src/include/fteparse.h src/include/dvec.h src/include/grid.h src/include/plot.h src/include/pnode.h src/include/sim.h src/include/variable.h src/include/wordlist.h src/include/bool.h: Separation of header files into smaller pieces. This limits recompilation to only the affected source files. The original header files have a warning message embedded to flag obsoleted use. * src/frontend/compose.c src/frontend/compose.h src/frontend/nutctab.c src/frontend/nutctab.h src/frontend/plot5.c src/frontend/plot5.h src/frontend/spcmdtab.c src/frontend/x11.c src/frontend/x11.h src/frontend/xgraph.c src/frontend/xgraph.h: Moved these files into src/frontend/plotting subdirectory. * src/frontend/plotting/.cvsignore src/frontend/plotting/Makefile.am src/frontend/plotting/plot5.c src/frontend/plotting/plot5.h src/frontend/plotting/plotting.c src/frontend/plotting/plotting.h src/frontend/plotting/pvec.c src/frontend/plotting/pvec.h src/frontend/plotting/x11.c src/frontend/plotting/x11.h src/frontend/plotting/xgraph.c src/frontend/plotting/xgraph.h: The new libplotting library with automake and CVS infrastructure.
2000-05-06 16:12:51 +02:00
#include "completion.h"
src/Makefile.am src/help.c src/main.c src/circuit/Makefile.am src/circuit/ifnewuid.c src/frontend/Makefile.am src/frontend/aspice.c src/frontend/circuits.h src/frontend/com_display.c src/frontend/com_hardcopy.c src/frontend/commands.c src/frontend/commands.h src/frontend/cpitf.c src/frontend/debugcom.c src/frontend/device.c src/frontend/diff.c src/frontend/display.c src/frontend/dotcards.c src/frontend/fourier.c src/frontend/inp.c src/frontend/inpcom.c src/frontend/linear.c src/frontend/misccoms.c src/frontend/mw_coms.c src/frontend/nutinp.c src/frontend/options.c src/frontend/outitf.c src/frontend/parse.c src/frontend/postcoms.c src/frontend/postsc.c src/frontend/rawfile.c src/frontend/resource.c src/frontend/runcoms.c src/frontend/runcoms2.c src/frontend/shyu.c src/frontend/spec.c src/frontend/spiceif.c src/frontend/subckt.c src/frontend/vectors.c src/frontend/where.c src/frontend/plotting/Makefile.am src/frontend/plotting/agraf.c src/frontend/plotting/graf.c src/frontend/plotting/plotcurv.c src/frontend/plotting/plotit.c src/frontend/plotting/x11.c src/frontend/plotting/xgraph.c src/include/Makefile.am src/maths/cmaths/cmath4.c src/misc/terminal.c src/misc/terminal.h src/parser/cshpar.c src/parser/front.c src/parser/front.h src/parser/history.c src/parser/history.h src/parser/modify.c src/parser/var2.c src/parser/var2.h src/parser/variable.c: Refactoring of frontend code. * src/include/ftehelp.h src/include/variable.h: Moved into frontend directory. * src/include/cpdefs.h src/include/cpextern.h src/include/ftedefs.h src/include/plot.h: Updates.
2000-06-27 18:09:02 +02:00
#include "runcoms.h"
#include "variable.h"
#include "spiceif.h"
* src/Makefile.am src/main.c src/sconvert.c src/analysis/cktdisto.c src/analysis/cktnoise.c src/analysis/noisean.c: Updates for the new header files. * src/maths/cmaths/cmath1.c src/maths/cmaths/cmath2.c src/maths/cmaths/cmath3.c src/maths/cmaths/cmath4.c: Updates for the new header files. * src/frontend/.cvsignore src/frontend/Makefile.am: Updates for the new files. * src/frontend/agraf.c src/frontend/aspice.c src/frontend/breakp.c src/frontend/breakp2.c src/frontend/circuits.c src/frontend/cpitf.c src/frontend/debugcom.c src/frontend/define.c src/frontend/diff.c src/frontend/dimens.c src/frontend/display.c src/frontend/doplot.c src/frontend/dotcards.c src/frontend/evaluate.c src/frontend/fourier.c src/frontend/graf.c src/frontend/grid.c src/frontend/inp.c src/frontend/inpcom.c src/frontend/interp.c src/frontend/linear.c src/frontend/misccoms.c src/frontend/misccoms.h src/frontend/miscvars.c src/frontend/mw_coms.c src/frontend/newcoms.c src/frontend/nutinp.c src/frontend/options.c src/frontend/outitf.c src/frontend/parse.c src/frontend/plotcurv.c src/frontend/points.c src/frontend/postcoms.c src/frontend/rawfile.c src/frontend/runcoms.c src/frontend/runcoms2.c src/frontend/shyu.c src/frontend/spec.c src/frontend/spiceif.c src/frontend/typesdef.c src/frontend/vectors.c src/frontend/where.c src/frontend/postcoms.c: Updates for the new header files. Some commands have moved into the new files below. * src/frontend/README src/frontend/com_compose.c src/frontend/com_compose.h src/frontend/com_display.c src/frontend/com_display.h src/frontend/com_let.c src/frontend/com_let.h src/frontend/com_setscale.c src/frontend/com_setscale.h src/frontend/commands.c src/frontend/commands.h src/frontend/completion.h src/frontend/streams.h src/frontend/testcommands.c: Separation into different com_* commands. This is a start. The rest of the subdirectory needs doing. * src/include/complex.h src/include/cpdefs.h src/include/cpextern.h src/include/cpstd.h src/include/fteconst.h src/include/ftedata.h src/include/ftedev.h src/include/fteext.h src/include/ftegraph.h src/include/fteparse.h src/include/dvec.h src/include/grid.h src/include/plot.h src/include/pnode.h src/include/sim.h src/include/variable.h src/include/wordlist.h src/include/bool.h: Separation of header files into smaller pieces. This limits recompilation to only the affected source files. The original header files have a warning message embedded to flag obsoleted use. * src/frontend/compose.c src/frontend/compose.h src/frontend/nutctab.c src/frontend/nutctab.h src/frontend/plot5.c src/frontend/plot5.h src/frontend/spcmdtab.c src/frontend/x11.c src/frontend/x11.h src/frontend/xgraph.c src/frontend/xgraph.h: Moved these files into src/frontend/plotting subdirectory. * src/frontend/plotting/.cvsignore src/frontend/plotting/Makefile.am src/frontend/plotting/plot5.c src/frontend/plotting/plot5.h src/frontend/plotting/plotting.c src/frontend/plotting/plotting.h src/frontend/plotting/pvec.c src/frontend/plotting/pvec.h src/frontend/plotting/x11.c src/frontend/plotting/x11.h src/frontend/plotting/xgraph.c src/frontend/plotting/xgraph.h: The new libplotting library with automake and CVS infrastructure.
2000-05-06 16:12:51 +02:00
#ifdef XSPICE
/* gtri - add - 12/12/90 - wbk - include ipc stuff */
#include "ipctiein.h"
/* gtri - end - 12/12/90 */
#endif
2000-04-27 22:03:57 +02:00
/* static declarations */
static int dosim(char *what, wordlist *wl);
/* Routines for the commands op, tran, ac, dc, listing, device, state,
* resume, stop, trace, run, end. Op, tran, ac, and dc cause the action
* to be performed immediately, and run causes whatever actions were
* present in the deck to be carried out. End has the effect of stopping
2009-11-17 23:51:55 +01:00
* any simulations in progress, as opposed to ending the input deck as
2000-04-27 22:03:57 +02:00
* the .end line does.
*/
FILE *rawfileFp;
bool rawfileBinary;
#define RAWBUF_SIZE 32768
char rawfileBuf[RAWBUF_SIZE];
/*To tell resume the rawfile name saj*/
char *last_used_rawfile = NULL;
/*end saj */
2000-04-27 22:03:57 +02:00
2009-11-17 23:51:55 +01:00
/* command "setcirc" */
2000-04-27 22:03:57 +02:00
void
com_scirc(wordlist *wl)
{
struct circ *p;
int i, j = 0;
char buf[BSIZE_SP];
if (ft_circuits == NULL) {
fprintf(cp_err, "Error: there aren't any circuits loaded.\n");
return;
}
if (wl == NULL) {
fprintf(cp_out,
"\tType the number of the desired circuit:\n\n");
for (p = ft_circuits; p; p = p->ci_next) {
if (ft_curckt == p)
fprintf(cp_out, "Current");
fprintf(cp_out, "\t%d\t%s\n", ++j, p->ci_name);
}
fprintf(cp_out, "? ");
(void) fflush(cp_out);
(void) fgets(buf, BSIZE_SP, cp_in);
clearerr(cp_in);
if ((sscanf(buf, " %d ", &i) != 1) || (i < 0) || (i > j))
return;
2010-07-24 20:51:06 +02:00
for (p = ft_circuits; --i > 0; p = p->ci_next)
;
2000-04-27 22:03:57 +02:00
} else {
for (p = ft_circuits; p; p = p->ci_next)
j++;
p=NULL;
if ((sscanf(wl->wl_word, " %d ", &i) != 1) || (i < 0) || (i > j));
else
2010-07-24 20:51:06 +02:00
for (p = ft_circuits; --i > 0; p = p->ci_next)
;
/* for (p = ft_circuits; p; p = p->ci_next)
* if (ciprefix(wl->wl_word, p->ci_name))
* break;
*/
if (p == NULL)
{
fprintf(cp_err, "Warning: no such circuit \"%s\"\n",wl->wl_word);
2000-04-27 22:03:57 +02:00
return;
}
fprintf(cp_out, "\t%s\n", p->ci_name);
}
if (ft_curckt) {
/* Actually this can't be FALSE */
ft_curckt->ci_devices =
cp_kwswitch(CT_DEVNAMES, p->ci_devices);
ft_curckt->ci_nodes = cp_kwswitch(CT_NODENAMES, p->ci_nodes);
}
ft_curckt = p;
return;
}
void
com_pz(wordlist *wl)
{
dosim("pz", wl);
return;
}
void
com_op(wordlist *wl)
{
dosim("op", wl);
return;
}
void
com_dc(wordlist *wl)
{
dosim("dc", wl);
return;
}
void
com_ac(wordlist *wl)
{
dosim("ac", wl);
return;
}
void
com_tf(wordlist *wl)
{
dosim("tf", wl);
return;
}
void
com_tran(wordlist *wl)
{
dosim("tran", wl);
return;
}
void
com_sens(wordlist *wl)
{
dosim("sens", wl);
return;
}
void
com_disto(wordlist *wl)
{
dosim("disto", wl);
return;
}
void
com_noise(wordlist *wl)
{
dosim("noise", wl);
return;
}
static int
2009-11-17 23:51:55 +01:00
dosim(
char *what, /* in: command (pz,op,dc,ac,tf,tran,sens,disto,noise,run) */
wordlist *wl /* in: command option */
/* global variables in: ft_curckt, ft_circuits,
out: ft_setflag, ft_intrpt, rawfileFp, rawfileBinary,
last_used_rawfile
*/
)
2000-04-27 22:03:57 +02:00
{
2009-11-17 23:51:55 +01:00
wordlist *ww = NULL;
bool dofile = FALSE;
char buf[BSIZE_SP];
struct circ *ct;
int err = 0;
/* set file type to binary or to what is given by environmental
variable SPICE_ASCIIRAWFILE in ivars.c */
bool ascii = AsciiRawFile;
if (eq(what, "run") && wl)
dofile = TRUE;
/* add "what" to beginning of wordlist wl, except "what" equals "run"
and a rawfile name is given (in wl) */
if (!dofile) {
ww = alloc(struct wordlist);
ww->wl_next = wl;
if (wl)
wl->wl_prev = ww;
ww->wl_word = copy(what);
}
/* reset output file type according to variable given in spinit */
if (cp_getvar("filetype", CP_STRING, buf)) {
2009-11-17 23:51:55 +01:00
if (eq(buf, "binary"))
ascii = FALSE;
else if (eq(buf, "ascii"))
ascii = TRUE;
else {
fprintf(cp_err,
"Warning: strange file type \"%s\" (using \"ascii\")\n", buf);
ascii = TRUE;
}
}
if (!ft_curckt) {
fprintf(cp_err, "Error: there aren't any circuits loaded.\n");
return 1;
} else if (ft_curckt->ci_ckt == NULL) { /* Set noparse? */
fprintf(cp_err, "Error: circuit not parsed.\n");
return 1;
}
for (ct = ft_circuits; ct; ct = ct->ci_next)
if (ct->ci_inprogress && (ct != ft_curckt)) {
fprintf(cp_err,
"Warning: losing old state for circuit '%s'\n",
ct->ci_name);
ct->ci_inprogress = FALSE;
}
/* "resume" will never occur in ngspice */
if (ft_curckt->ci_inprogress && eq(what, "resume")) {
ft_setflag = TRUE; /* don't allow abort upon interrupt during run */
ft_intrpt = FALSE;
fprintf(cp_err, "Warning: resuming run in progress.\n");
2010-06-23 19:40:56 +02:00
com_resume(NULL);
2009-11-17 23:51:55 +01:00
ft_setflag = FALSE; /* Now allow aborts again */
return 0;
}
/* From now on until the next prompt, an interrupt will just
* set a flag and let spice finish up, then control will be
* passed back to the user.
*/
ft_setflag = TRUE; /* Don't allow abort upon interrupt during run. */
ft_intrpt = FALSE;
/* command "run" is given with rawfile name in wl */
if (dofile) {
2000-04-27 22:03:57 +02:00
#ifdef PARALLEL_ARCH
if (ARCHme == 0) {
#endif /* PARALLEL_ARCH */
2009-11-17 23:51:55 +01:00
if (!*wl->wl_word)
rawfileFp = stdout;
#if defined(__MINGW32__) || defined(_MSC_VER)
2009-11-17 23:51:55 +01:00
/* ask if binary or ASCII, open file with wb or w */
else if (ascii) {
if(!(rawfileFp = fopen(wl->wl_word, "w"))) {
perror(wl->wl_word);
ft_setflag = FALSE;
return 1;
}
fprintf(cp_out,"ASCII raw file\n");
}
else if (!ascii) {
if(!(rawfileFp = fopen(wl->wl_word, "wb"))) {
perror(wl->wl_word);
ft_setflag = FALSE;
return 1;
}
fprintf(cp_out,"binary raw file\n");
}
/*---------------------------------------------------------------------------*/
2002-01-03 23:44:21 +01:00
#else
2009-11-17 23:51:55 +01:00
else if (!(rawfileFp = fopen(wl->wl_word, "w"))) {
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
perror(wl->wl_word);
ft_setflag = FALSE;
return 1;
}
2002-01-03 23:44:21 +01:00
#endif /* __MINGW32__ */
2009-11-17 23:51:55 +01:00
rawfileBinary = !ascii;
2000-04-27 22:03:57 +02:00
#ifdef PARALLEL_ARCH
2009-11-17 23:51:55 +01:00
} else {
rawfileFp = NULL;
}
2000-04-27 22:03:57 +02:00
#endif /* PARALLEL_ARCH */
2009-11-17 23:51:55 +01:00
} else {
rawfileFp = NULL;
}
/*save rawfile name */
if(last_used_rawfile)
tfree(last_used_rawfile);
if(rawfileFp){
last_used_rawfile = copy(wl->wl_word);
2009-11-17 23:51:55 +01:00
} else {
last_used_rawfile = NULL;
2009-11-17 23:51:55 +01:00
}
ft_curckt->ci_inprogress = TRUE;
/* "sens2" not used in ngspice */
if (eq(what,"sens2")) {
if (if_sens_run(ft_curckt->ci_ckt, ww, ft_curckt->ci_symtab) == 1) {
/* The circuit was interrupted somewhere. */
fprintf(cp_err, "%s simulation interrupted\n", what);
#ifdef XSPICE
/* gtri - add - 12/12/90 - wbk - record error and return errchk */
2009-11-17 23:51:55 +01:00
g_ipc.run_error = IPC_TRUE;
if(g_ipc.enabled)
ipc_send_errchk();
/* gtri - end - 12/12/90 */
#endif
2009-11-17 23:51:55 +01:00
} else
ft_curckt->ci_inprogress = FALSE;
/* Do a run of the circuit */
} else {
err = if_run(ft_curckt->ci_ckt, what, ww, ft_curckt->ci_symtab);
if (err == 1) {
/* The circuit was interrupted somewhere. */
fprintf(cp_err, "%s simulation interrupted\n", what);
#ifdef XSPICE
2009-11-17 23:51:55 +01:00
/* record error and return errchk */
g_ipc.run_error = IPC_TRUE;
if(g_ipc.enabled)
ipc_send_errchk();
2009-11-17 23:51:55 +01:00
/* gtri - end - 12/12/90 */
#endif
2009-11-17 23:51:55 +01:00
err = 0;
} else if (err == 2) {
fprintf(cp_err, "%s simulation(s) aborted\n", what);
ft_curckt->ci_inprogress = FALSE;
err = 1;
} else
ft_curckt->ci_inprogress = FALSE;
}
/* close the rawfile */
if (rawfileFp){
if (ftell(rawfileFp)==0) {
2009-11-17 23:51:55 +01:00
(void) fclose(rawfileFp);
(void) remove(wl->wl_word);
} else {
(void) fclose(rawfileFp);
}
}
ft_curckt->ci_runonce = TRUE;
ft_setflag = FALSE;
/* va: garbage collection: unlink first word (inserted here) and tfree it */
if (!dofile) {
tfree(ww->wl_word);
if (wl)
wl->wl_prev = NULL;
tfree(ww);
}
/* execute the .measure statements */
if ( !err && ft_curckt->ci_last_an && ft_curckt->ci_meas)
do_measure( ft_curckt->ci_last_an, FALSE );
2009-11-17 23:51:55 +01:00
return err;
2000-04-27 22:03:57 +02:00
}
2009-11-17 23:51:55 +01:00
/* Usage is run [filename] */
2000-04-27 22:03:57 +02:00
void
com_run(wordlist *wl)
{
/* ft_getsaves(); */
dosim("run", wl);
return;
}
int
ft_dorun(char *file)
{
static wordlist wl = { NULL, NULL, NULL } ;
wl.wl_word = file;
if (file)
return dosim("run", &wl);
2000-04-27 22:03:57 +02:00
else
return dosim("run", (wordlist *) NULL);
2000-04-27 22:03:57 +02:00
}
/* ARGSUSED */ /* until the else clause gets put back */
bool
ft_getOutReq(FILE **fpp, struct plot **plotp, bool *binp, char *name, char *title)
{
2009-11-17 23:51:55 +01:00
if (rawfileFp) {
*fpp = rawfileFp;
*binp = rawfileBinary;
return (TRUE);
} else {
return (FALSE);
}
2000-04-27 22:03:57 +02:00
}