diff --git a/src/frontend/outitf.c b/src/frontend/outitf.c index 0e617df92..3416ce3af 100644 --- a/src/frontend/outitf.c +++ b/src/frontend/outitf.c @@ -34,6 +34,7 @@ Modified: 2000 AlansFixes, 2013/2015 patch by Krzysztof Blaszkowski extern char *spice_analysis_get_name(int index); extern char *spice_analysis_get_description(int index); +extern int EVTsetup_plot(CKTcircuit* ckt, char* plotname); static int beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analName, @@ -398,6 +399,11 @@ beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analNam plotInit(run); if (refName) run->runPlot->pl_ndims = 1; +#ifdef XSPICE + /* set the current plot name into the event job */ + if (run->runPlot->pl_typename) + EVTsetup_plot(run->circuit, run->runPlot->pl_typename); +#endif } } diff --git a/src/include/ngspice/evt.h b/src/include/ngspice/evt.h index 1581369e4..5afe1df92 100644 --- a/src/include/ngspice/evt.h +++ b/src/include/ngspice/evt.h @@ -335,6 +335,7 @@ struct Evt_Limit { struct Evt_Job { int num_jobs; /* Number of jobs run */ char **job_name; /* Names of different jobs */ + char **job_plot; /* Names of different plots created by the job */ Evt_Node_Data_t **node_data; /* node_data for different jobs */ Evt_State_Data_t **state_data; /* state_data for different jobs */ Evt_Msg_Data_t **msg_data; /* messages for different jobs */ diff --git a/src/xspice/evt/evtdest.c b/src/xspice/evt/evtdest.c index 7dae8340c..9ab6683f6 100644 --- a/src/xspice/evt/evtdest.c +++ b/src/xspice/evt/evtdest.c @@ -260,6 +260,8 @@ Evt_Job_destroy(Evt_Job_t *job) for (i = 0; i < job->num_jobs; i++) tfree(job->job_name[i]); + for (i = 0; i < job->num_jobs; i++) + tfree(job->job_plot[i]); tfree(job->job_name); tfree(job->node_data); diff --git a/src/xspice/evt/evtsetup.c b/src/xspice/evt/evtsetup.c index 880fd382c..d1edce608 100644 --- a/src/xspice/evt/evtsetup.c +++ b/src/xspice/evt/evtsetup.c @@ -61,7 +61,7 @@ static int EVTsetup_data(CKTcircuit *ckt); static int EVTsetup_jobs(CKTcircuit *ckt); static int EVTsetup_load_ptrs(CKTcircuit *ckt); - +int EVTsetup_plot(CKTcircuit* ckt, char* plotname); /* Allocation macros with built-in check for out-of-memory */ @@ -469,6 +469,7 @@ static int EVTsetup_jobs( /* Allocate/reallocate necessary pointers */ CKREALLOC(jobs->job_name, num_jobs, char *) + CKREALLOC(jobs->job_plot, num_jobs, char *) CKREALLOC(jobs->node_data, num_jobs, Evt_Node_Data_t *) CKREALLOC(jobs->state_data, num_jobs, Evt_State_Data_t *) CKREALLOC(jobs->msg_data, num_jobs, Evt_Msg_Data_t *) @@ -477,6 +478,7 @@ static int EVTsetup_jobs( /* Fill in the pointers, etc. for this new job */ i = num_jobs - 1; jobs->job_name[i] = MIFcopy(ckt->CKTcurJob->JOBname); + jobs->job_plot[i] = NULL; /* fill in later */ jobs->node_data[i] = data->node; jobs->state_data[i] = data->state; jobs->msg_data[i] = data->msg; @@ -599,3 +601,16 @@ static int EVTsetup_load_ptrs( return(OK); } + +/* get the analog plot name and store it into the current event job */ +int EVTsetup_plot(CKTcircuit* ckt, char *plotname) { + if (ckt->evt->counts.num_insts == 0) + return(OK); + + Evt_Job_t* jobs = &(ckt->evt->jobs); + if (jobs) { + jobs->job_plot[jobs->num_jobs - 1] = copy(plotname); + return OK; + } + return 1; +}