Unify batch mode and control mode raw file output:
Voltage is always named as v(nodename)
This commit is contained in:
parent
36098b93bd
commit
064bd39a2f
|
|
@ -845,8 +845,10 @@ OUTattributes(runDesc *plotPtr, IFuid varName, int param, IFvalue *value)
|
|||
}
|
||||
|
||||
|
||||
/* The file writing routines. */
|
||||
|
||||
/* The file writing routines.
|
||||
Write a raw file in batch mode (-b and -r flags).
|
||||
Writing a raw file in interactive or control mode is handled
|
||||
by raw_write() in rawfile.c */
|
||||
static void
|
||||
fileInit(runDesc *run)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,8 +33,9 @@ int raw_prec = -1; /* How many sigfigs to use, default 15 (max). */
|
|||
#endif
|
||||
|
||||
|
||||
/* Write a raw file. We write everything in the plot pointed to. */
|
||||
|
||||
/* Write a raw file with the 'write' command. We write everything in the plot pointed to.
|
||||
Writing a raw file in batch mode is handled by fileInit_pass1() and fileInit_pass2()
|
||||
in outitf.c */
|
||||
void raw_write(char *name, struct plot *pl, bool app, bool binary)
|
||||
{
|
||||
FILE *fp;
|
||||
|
|
@ -153,17 +154,26 @@ void 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) {
|
||||
/* write i(name) instaed of name#branch */
|
||||
if (v->v_type == SV_CURRENT) {
|
||||
branch = NULL;
|
||||
/* get name only*/
|
||||
if ((branch = strstr(v->v_name, "#branch")) != NULL) {
|
||||
*branch = '\0';
|
||||
}
|
||||
fprintf(fp, "\t%d\ti(%s)\t%s", i++, v->v_name, ft_typenames(v->v_type));
|
||||
/* restore name#branch */
|
||||
if (branch != NULL) *branch = '#';
|
||||
}
|
||||
/* write v(name)*/
|
||||
else if (v->v_type == SV_VOLTAGE) {
|
||||
fprintf(fp, "\t%d\t%s\t%s", i++, v->v_name, ft_typenames(v->v_type));
|
||||
/* If the node name is a number, the vector is already called v(name) */
|
||||
if (ciprefix("v(", v->v_name))
|
||||
fprintf(fp, "\t%d\t%s\t%s", i++, v->v_name, ft_typenames(v->v_type));
|
||||
else
|
||||
fprintf(fp, "\t%d\tv(%s)\t%s", i++, v->v_name, ft_typenames(v->v_type));
|
||||
}
|
||||
/* write 'name' only for all other vector types */
|
||||
else {
|
||||
fprintf(fp, "\t%d\t%s\t%s", i++, v->v_name, ft_typenames(v->v_type));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue