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
|
|
|
|
|
**********/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Code to deal with breakpoints and tracing.
|
|
|
|
|
*/
|
|
|
|
|
|
2011-12-11 19:05:00 +01:00
|
|
|
#include "ngspice/ngspice.h"
|
|
|
|
|
#include "ngspice/cpdefs.h"
|
|
|
|
|
#include "ngspice/ftedefs.h"
|
|
|
|
|
#include "ngspice/dvec.h"
|
|
|
|
|
#include "ngspice/ftedebug.h"
|
* frontend/Makefile.am: Updates for new files.
* frontend/breakp2.c, frontend/newcoms.c, frontend/postcoms.c,
frontend/resource.c, frontend/terminal.h, frontend/variable.c,
frontend/variable.h, frontend/com_compose.c,
frontend/com_display.c, frontend/com_setscale.c,
frontend/com_strcmp.c: Include files update.
* parser/var2.c, parser/var2.h: Empty files, removed.
* parser/Makefile.am: Updates for removed files.
* parser/lexical.c: Small adjustments
* parser/input.c, parser/input.h: Input, output and error streams
handled in the frontend. Moved to the frontend directory.
* frontend/streams.c: Its new home.
2000-07-07 16:09:06 +02:00
|
|
|
#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;
|
|
|
|
|
}
|
2011-04-28 17:59:36 +02:00
|
|
|
/* wrd_chtrace(NULL, TRUE, what); */
|
2000-04-27 22:03:57 +02:00
|
|
|
} 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); */
|
|
|
|
|
}
|
2000-10-26 19:02:12 +02:00
|
|
|
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);
|
|
|
|
|
|
2010-10-28 21:32:34 +02:00
|
|
|
*savesp = array = TMALLOC(struct save_info, count);
|
2000-04-27 22:03:57 +02:00
|
|
|
|
|
|
|
|
for (d = dbs; d; d = d->db_next)
|
|
|
|
|
if (d->db_type == DB_SAVE) {
|
|
|
|
|
array[i].used = 0;
|
|
|
|
|
if (d->db_analysis)
|
2011-12-17 14:41:04 +01:00
|
|
|
array[i].analysis = copy(d->db_analysis);
|
2000-04-27 22:03:57 +02:00
|
|
|
else
|
|
|
|
|
array[i].analysis = NULL;
|
|
|
|
|
array[i++].name = copy(d->db_nodename1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (count);
|
|
|
|
|
}
|