ngspice/src/frontend/breakp2.c

130 lines
3.0 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
$Id$
2000-04-27 22:03:57 +02:00
**********/
/*
* Code to deal with breakpoints and tracing.
*/
#include "ngspice.h"
#include "cpdefs.h"
#include "ftedefs.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
#include "ftedebug.h"
#include "quote.h"
2000-04-27 22:03:57 +02:00
#include "breakp2.h"
2009-12-19 17:04:22 +01:00
/* global linked list to store .save data and breakpoint data */
2000-04-27 22:03:57 +02:00
struct dbcomm *dbs = NULL; /* export for iplot */
2009-12-19 17:04:22 +01:00
/* used in breakp.c and breakp2.c */
2000-04-27 22:03:57 +02:00
int debugnumber = 1;
2009-12-19 17:04:22 +01:00
/* Analyse the data given by the .save card or 'save' command.
Store the data in the global dbs struct.
2000-04-27 22:03:57 +02:00
*/
/* Save a vector. */
void
com_save(wordlist *wl)
{
settrace(wl, VF_ACCUM, NULL);
return;
}
2009-12-19 17:04:22 +01:00
/* Save a vector with the analysis type given (name). */
2000-04-27 22:03:57 +02:00
void
com_save2(wordlist *wl, char *name)
{
settrace(wl, VF_ACCUM, name);
return;
}
void
settrace(wordlist *wl, int what, char *name)
{
struct dbcomm *d, *td;
char *s;
while (wl) {
s = cp_unquote(wl->wl_word);
d = alloc(struct dbcomm);
d->db_number = debugnumber++;
d->db_analysis = name;
if (eq(s, "all")) {
switch (what) {
case VF_PRINT:
d->db_type = DB_TRACEALL;
break;
/* case VF_PLOT:
d->db_type = DB_IPLOTALL;
break; */
case VF_ACCUM:
/* d->db_type = DB_SAVEALL; */
d->db_nodename1 = copy(s);
d->db_type = DB_SAVE;
break;
}
/* wrd_chtrace((char *) NULL, TRUE, what); */
} else {
switch (what) {
case VF_PRINT:
d->db_type = DB_TRACENODE;
break;
/* case VF_PLOT:
d->db_type = DB_IPLOT;
break; */
case VF_ACCUM:
d->db_type = DB_SAVE;
break;
}
d->db_nodename1 = copy(s);
/* wrd_chtrace(s, TRUE, what); */
}
tfree(s);/*DG avoid memoy leak */
2000-04-27 22:03:57 +02:00
if (dbs) {
for (td = dbs; td->db_next; td = td->db_next)
;
td->db_next = d;
} else
dbs = d;
wl = wl->wl_next;
}
return;
}
2009-12-19 17:04:22 +01:00
/* retrieve the save nodes from dbs into an array */
2000-04-27 22:03:57 +02:00
int
ft_getSaves(struct save_info **savesp)
2009-12-19 17:04:22 +01:00
/* global variable: dbs */
2000-04-27 22:03:57 +02:00
{
struct dbcomm *d;
int count = 0, i = 0;
struct save_info *array;
for (d = dbs; d; d = d->db_next)
if (d->db_type == DB_SAVE)
count++;
2009-12-19 17:04:22 +01:00
2000-04-27 22:03:57 +02:00
if (!count)
return (0);
*savesp = array = (struct save_info *)
tmalloc(sizeof (struct save_info) * count);
for (d = dbs; d; d = d->db_next)
if (d->db_type == DB_SAVE) {
array[i].used = 0;
if (d->db_analysis)
array[i].analysis = (IFuid *) copy(d->db_analysis);
else
array[i].analysis = NULL;
array[i++].name = copy(d->db_nodename1);
}
return (count);
}