add function EVTswitch_plot() to switch the event data

according tothe (analog) plot. Called from plot_setcur()
in vetors.c, when command 'setplot xxx' is given.
This commit is contained in:
Holger Vogt 2020-04-18 14:01:26 +02:00
parent d72b4c415f
commit bbb0007466
4 changed files with 42 additions and 5 deletions

View File

@ -33,11 +33,9 @@ static struct dvec *find_permanent_vector_by_name(
static enum ALL_TYPE_ENUM get_all_type(const char *word);
static bool plot_prefix(const char *pre, const char *str);
#ifdef XSPICE
/* gtri - begin - add function prototype for EVTfindvec */
extern int EVTswitch_plot(CKTcircuit* ckt, const char* plottypename);
struct dvec *EVTfindvec(char *node);
/* gtri - end - add function prototype for EVTfindvec */
#endif
@ -1133,6 +1131,7 @@ void plot_setcur(const char *name)
}
if (prev_pl) { /* found */
plot_cur = prev_pl;
EVTswitch_plot(ft_curckt->ci_ckt, plot_cur->pl_typename);
}
else { /* no next plot */
fprintf(cp_err,
@ -1157,6 +1156,7 @@ void plot_setcur(const char *name)
plot_cur->pl_ccom = cp_kwswitch(CT_VECTOR, pl->pl_ccom);
}
*/
EVTswitch_plot(ft_curckt->ci_ckt, name);
plot_cur = pl;
} /* end of function plot_setcur */

View File

@ -334,6 +334,7 @@ struct Evt_Limit {
struct Evt_Job {
int num_jobs; /* Number of jobs run */
int cur_job; /* job selected for plotting etc */
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 */

View File

@ -413,7 +413,7 @@ EVTdisplay(wordlist *wl)
out_printf("No event node available!\n");
return;
}
out_printf("\nList of event nodes\n");
out_printf("\nList of event nodes in plot %s\n", ckt->evt->jobs.job_plot[ckt->evt->jobs.cur_job]);
out_printf(" %-20s: %-5s, %s\n\n", "node name", "type", "number of events");
node_index = 0;
while (node) {

View File

@ -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);
int EVTsetup_plot(CKTcircuit* ckt, char* plottypename);
/* Allocation macros with built-in check for out-of-memory */
@ -610,7 +610,43 @@ int EVTsetup_plot(CKTcircuit* ckt, char *plotname) {
Evt_Job_t* jobs = &(ckt->evt->jobs);
if (jobs) {
jobs->job_plot[jobs->num_jobs - 1] = copy(plotname);
jobs->cur_job = jobs->num_jobs - 1;
return OK;
}
return 1;
}
/* If command 'setplot' is called, we switch to the corresponding event data.
Their pointers have been stored in the jobs structure.*/
int EVTswitch_plot(CKTcircuit* ckt, const char* plottypename) {
int i;
bool found = FALSE;
Evt_Job_t* jobs;
Evt_Data_t* data;
if (ckt->evt->counts.num_insts == 0)
return(OK);
jobs = &(ckt->evt->jobs);
data = &(ckt->evt->data);
if (jobs) {
/* check for the job with current plot type name , e.g. tran2 */
for (i = 0; i < jobs->num_jobs; i++) {
if (jobs->job_plot[i] && eq(jobs->job_plot[i], plottypename)) {
found = TRUE;
jobs->cur_job = i;
break;
}
}
if (found) {
data->node = jobs->node_data[i];
data->state = jobs->state_data[i];
data->msg = jobs->msg_data[i];
data->statistics = jobs->statistics[i];
return OK;
}
}
return 1;
}