From 56626999fc647750da1da4f0dde24887a8e44e6e Mon Sep 17 00:00:00 2001 From: pnenzi Date: Mon, 8 Oct 2007 20:18:38 +0000 Subject: [PATCH] Improved current vectors output and added element for last analysis run --- ChangeLog | 5 +++++ src/frontend/outitf.c | 30 +++++++++++++++++++++--------- src/frontend/rawfile.c | 15 +++++++++++++-- src/frontend/runcoms.c | 7 ++++--- src/include/ftedefs.h | 1 + 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6553242fd..fcf98fe22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-10-8 Paolo Nenzi + * src/frontend/{rawfile.c, outitf.c, runcoms.c}, src/include/ftedefs.h: + modified current vectors output amd added struct elements for holding the + name of the last analysis run (all from Phil Barker patch). + 2007-10-8 Paolo Nenzi *src/frontend/{device.c, device.h}: modified 'show' command to match SmartSpice syntax from Phil Barker patch. diff --git a/src/frontend/outitf.c b/src/frontend/outitf.c index b0222fc6b..cc8c5e678 100644 --- a/src/frontend/outitf.c +++ b/src/frontend/outitf.c @@ -146,6 +146,7 @@ beginPlot(void *analysisPtr, void *circuitPtr, char *cktName, char *analName, ch run->numData = 0; an_name = spice_analysis_get_name(((JOB *) analysisPtr)->JOBtype); + ft_curckt->ci_last_an = an_name; /* Now let's see which of these things we need. First toss in the * reference vector. Then toss in anything that getSaves() tells @@ -725,10 +726,10 @@ fileInit(runDesc *run) run->pointPos = i; fprintf(run->fp, "0 \n"); /* Save 8 spaces here. */ - fprintf(run->fp, "Command: version %s\n", ft_sim->version); + /*fprintf(run->fp, "Command: version %s\n", ft_sim->version);*/ fprintf(run->fp, "Variables:\n"); - fprintf(stderr, "No. of Data Columns : %d \n", run->numData); + printf("No. of Data Columns : %d \n", run->numData); return; } @@ -737,12 +738,12 @@ static void fileInit_pass2(runDesc *run) { int i, type; - char *name, buf[BSIZE_SP]; + char *name, buf[BSIZE_SP], *branch; for (i = 0; i < run->numData; i++) { if (isdigit(*run->data[i].name)) { - (void) sprintf(buf, "V(%s)", run->data[i].name); + (void) sprintf(buf, "v(%s)", run->data[i].name); name = buf; } else { name = run->data[i].name; @@ -760,8 +761,18 @@ fileInit_pass2(runDesc *run) else type = SV_VOLTAGE; - fprintf(run->fp, "\t%d\t%s\t%s", i, name, - ft_typenames(type)); + if ( type == SV_CURRENT ) { + branch = NULL; + if ( (branch = strstr( name, "#branch" )) ) { + *branch = '\0'; + } + fprintf(run->fp, "\t%d\ti(%s)\t%s", i, name, ft_typenames(type)); + if ( branch != NULL ) *branch = '#'; + } else if ( type == SV_VOLTAGE ) { + fprintf(run->fp, "\t%d\tv(%s)\t%s", i, name, ft_typenames(type)); + } else { + fprintf(run->fp, "\t%d\t%s\t%s", i, name, ft_typenames(type)); + } if (run->data[i].gtype == GRID_XLOG) fprintf(run->fp, "\tgrid=3"); fprintf(run->fp, "\n"); @@ -844,7 +855,7 @@ fileEnd(runDesc *run) place = ftell(run->fp); fseek(run->fp, run->pointPos, 0); fprintf(run->fp, "%d", run->pointCount); - fprintf(stderr, "\nNo. of Data Rows : %d\n", run->pointCount); + printf("\nNo. of Data Rows : %d\n", run->pointCount); fseek(run->fp, place, 0); } else { /* Yet another hack-around */ @@ -966,8 +977,9 @@ plotAddComplexValue(dataDesc *desc, IFcomplex value) static void plotEnd(runDesc *run) { - fprintf(stderr, "\nNo. of Data Rows : %d\n", run->pointCount); - return; + fprintf(stderr,"\n"); + printf("\nNo. of Data Rows : %d\n", run->pointCount); + return; } diff --git a/src/frontend/rawfile.c b/src/frontend/rawfile.c index 786449cb7..c73cb757b 100644 --- a/src/frontend/rawfile.c +++ b/src/frontend/rawfile.c @@ -45,6 +45,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary) struct variable *vv; double dd; char buf[BSIZE_SP]; + char *branch; if (!cp_getvar("nopadding", VT_BOOL, (char *) &raw_padding)) raw_padding = FALSE; @@ -156,8 +157,18 @@ raw_write(char *name, struct plot *pl, bool app, bool binary) fprintf(fp, "Variables:\n"); for (i = 0, v = pl->pl_dvecs; v; v = v->v_next) { - fprintf(fp, "\t%d\t%s\t%s", i++, v->v_name, - ft_typenames(v->v_type)); + if ( strcmp( ft_typenames(v->v_type), "current" ) == 0 ) { + branch = NULL; + if ( (branch = strstr( v->v_name, "#branch" )) ) { + *branch = '\0'; + } + fprintf(fp, "\t%d\ti(%s)\t%s", i++, v->v_name, ft_typenames(v->v_type)); + if ( branch != NULL ) *branch = '#'; + } else if ( strcmp( ft_typenames(v->v_type), "voltage" ) == 0 ) { + fprintf(fp, "\t%d\tv(%s)\t%s", i++, v->v_name, ft_typenames(v->v_type)); + } else { + fprintf(fp, "\t%d\t%s\t%s", i++, v->v_name, ft_typenames(v->v_type)); + } if (v->v_flags & VF_MINGIVEN) fprintf(fp, " min=%e", v->v_minsignal); if (v->v_flags & VF_MAXGIVEN) diff --git a/src/frontend/runcoms.c b/src/frontend/runcoms.c index c13915c4d..c1ed53136 100644 --- a/src/frontend/runcoms.c +++ b/src/frontend/runcoms.c @@ -165,7 +165,6 @@ dosim(char *what, wordlist *wl) struct circ *ct; int err = 0; bool ascii = AsciiRawFile; - if (eq(what, "run") && wl) dofile = TRUE; if (!dofile) { @@ -258,6 +257,7 @@ dosim(char *what, wordlist *wl) } else { rawfileFp = NULL; } + /*save rawfile name saj*/ if(last_used_rawfile) tfree(last_used_rawfile); @@ -304,6 +304,7 @@ dosim(char *what, wordlist *wl) } else ft_curckt->ci_inprogress = FALSE; } + if (rawfileFp){ if (ftell(rawfileFp)==0) { (void) fclose(rawfileFp); @@ -344,9 +345,9 @@ ft_dorun(char *file) wl.wl_word = file; if (file) - return dosim("run", &wl); + return dosim("run", &wl); else - return dosim("run", (wordlist *) NULL); + return dosim("run", (wordlist *) NULL); } /* ARGSUSED */ /* until the else clause gets put back */ diff --git a/src/include/ftedefs.h b/src/include/ftedefs.h index 5c4fdc702..23f416a6a 100644 --- a/src/include/ftedefs.h +++ b/src/include/ftedefs.h @@ -45,6 +45,7 @@ struct circ { char *ci_defOpt; /* the default options anal. for this circuit */ char *ci_specOpt; /* the special options anal. for command line jobs */ char *ci_curOpt; /* the most recent options anal. for the circuit */ + char *ci_last_an; /* name of last analysis run */ } ;