2011-12-11 19:05:00 +01:00
|
|
|
#include "ngspice/ngspice.h"
|
|
|
|
|
#include "ngspice/bool.h"
|
|
|
|
|
#include "ngspice/wordlist.h"
|
|
|
|
|
#include "ngspice/fteext.h"
|
|
|
|
|
#include "ngspice/cpextern.h"
|
2000-05-06 16:12:51 +02:00
|
|
|
|
|
|
|
|
#include "com_display.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-06-27 18:09:02 +02:00
|
|
|
#include "variable.h"
|
2000-05-06 16:12:51 +02:00
|
|
|
#include "plotting/plotting.h"
|
|
|
|
|
#include "plotting/pvec.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* For the sort in display. */
|
|
|
|
|
static int
|
|
|
|
|
dcomp(const void *d1, const void *d2)
|
|
|
|
|
{
|
|
|
|
|
struct dvec **v1 = (struct dvec **) d1;
|
|
|
|
|
struct dvec **v2 = (struct dvec **) d2;
|
|
|
|
|
|
|
|
|
|
return (strcmp((*v1)->v_name, (*v2)->v_name));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Display vector status, etc. Note that this only displays stuff
|
|
|
|
|
* from the current plot, and you must do a setplot to see the rest of
|
|
|
|
|
* it. */
|
|
|
|
|
void
|
|
|
|
|
com_display(wordlist *wl)
|
|
|
|
|
{
|
|
|
|
|
struct dvec *d;
|
|
|
|
|
struct dvec **dvs;
|
|
|
|
|
int len = 0, i = 0;
|
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
|
|
/* Maybe he wants to know about just a few vectors. */
|
|
|
|
|
|
|
|
|
|
out_init();
|
2012-09-20 20:30:53 +02:00
|
|
|
|
2000-05-06 16:12:51 +02:00
|
|
|
while (wl) {
|
|
|
|
|
s = cp_unquote(wl->wl_word);
|
|
|
|
|
d = vec_get(s);
|
2012-09-20 20:30:53 +02:00
|
|
|
tfree(s); /*DG to avoid the cp_unquote memory leak */
|
2000-05-06 16:12:51 +02:00
|
|
|
if (d == NULL)
|
2012-09-20 20:30:53 +02:00
|
|
|
fprintf(cp_err, "Error: no such vector as %s.\n", wl->wl_word);
|
2000-05-06 16:12:51 +02:00
|
|
|
else
|
|
|
|
|
while (d) {
|
|
|
|
|
pvec(d);
|
|
|
|
|
d = d->v_link2;
|
|
|
|
|
}
|
|
|
|
|
if (wl->wl_next == NULL)
|
|
|
|
|
return;
|
|
|
|
|
wl = wl->wl_next;
|
|
|
|
|
}
|
2012-09-20 20:30:53 +02:00
|
|
|
|
2000-05-06 16:12:51 +02:00
|
|
|
if (plot_cur)
|
|
|
|
|
for (d = plot_cur->pl_dvecs; d; d = d->v_next)
|
|
|
|
|
len++;
|
2012-09-20 20:30:53 +02:00
|
|
|
|
2000-05-06 16:12:51 +02:00
|
|
|
if (len == 0) {
|
|
|
|
|
fprintf(cp_out, "There are no vectors currently active.\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-09-20 20:30:53 +02:00
|
|
|
|
2000-05-06 16:12:51 +02:00
|
|
|
out_printf("Here are the vectors currently active:\n\n");
|
2010-10-28 21:32:34 +02:00
|
|
|
dvs = TMALLOC(struct dvec *, len);
|
2000-05-06 16:12:51 +02:00
|
|
|
for (d = plot_cur->pl_dvecs, i = 0; d; d = d->v_next, i++)
|
|
|
|
|
dvs[i] = d;
|
2010-07-20 20:41:25 +02:00
|
|
|
if (!cp_getvar("nosort", CP_BOOL, NULL))
|
2012-09-20 20:30:53 +02:00
|
|
|
qsort(dvs, (size_t) len, sizeof(struct dvec *), dcomp);
|
|
|
|
|
|
|
|
|
|
out_printf("Title: %s\n", plot_cur->pl_title);
|
|
|
|
|
out_printf("Name: %s (%s)\nDate: %s\n\n",
|
|
|
|
|
plot_cur->pl_typename, plot_cur->pl_name,
|
|
|
|
|
plot_cur->pl_date);
|
2000-05-06 16:12:51 +02:00
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
|
d = dvs[i];
|
|
|
|
|
pvec(d);
|
|
|
|
|
}
|
2012-12-15 22:44:21 +01:00
|
|
|
tfree(dvs);
|
2000-05-06 16:12:51 +02:00
|
|
|
}
|