update to callback functions SendEvtData, SendInitEvtData

This commit is contained in:
h_vogt 2017-07-21 15:45:46 +02:00 committed by Holger Vogt
parent 3958783010
commit 11bafd70ea
3 changed files with 30 additions and 20 deletions

View File

@ -285,11 +285,30 @@ typedef int (GetSyncData)(double, double*, double, int, int, int, void*);
/* callback functions /* callback functions
addresses received from caller with ngSpice_Init_Evt() function addresses received from caller with ngSpice_Init_Evt() function
*/ */
typedef int (SendEvtData)(int, double, double, char *, void *, int, int, void*);
/* int index, double step, double dvalue, char *svalue, void *pvalue, int plen, int mode */ /* Upon time step finished, called per node */
typedef int (SendInitEvtData)(char*, void*); typedef int (SendEvtData)(int, double, double, char *, void *, int, int, int, void*);
/* /*
char* string with node info: "index name udn-name" int node index
double step, actual simulation time
double dvalue, a real value for specified structure component for plotting purposes
char *svalue, a string value for specified structure component for printing
void *pvalue, a binary data structure
int plen, size of the *pvalue structure
int mode, the mode (op, dc, tran) we are in
int ident, identification number of calling ngspice shared lib
void* return pointer received from caller
*/
/* Upon initialization, called once per event node
To build up a dictionary of nodes */
typedef int (SendInitEvtData)(int, int, char*, char*, int, void*);
/*
int node index
int maximum node index, number of nodes
char* node name
char* udn-name, node type
int identification number of calling ngspice shared lib
void* return pointer received from caller void* return pointer received from caller
*/ */
#endif #endif

View File

@ -1949,13 +1949,13 @@ sharedsync(double *pckttime, double *pcktdelta, double olddelta, double finalt,
void shared_send_event(int index, double step, double dvalue, char *svalue, void *pvalue, int plen, int mode) void shared_send_event(int index, double step, double dvalue, char *svalue, void *pvalue, int plen, int mode)
{ {
if(wantevtdata) if(wantevtdata)
sendevt(index, step, dvalue, svalue, pvalue, plen, mode, euserptr); sendevt(index, step, dvalue, svalue, pvalue, plen, mode, ng_ident, euserptr);
return; return;
} }
void shared_send_dict(char* dictline) void shared_send_dict(int index, int no_of_nodes, char* name, char*type)
{ {
if (sendinitevt) if (sendinitevt)
sendinitevt(dictline, euserptr); sendinitevt(index, no_of_nodes, name, type, ng_ident, euserptr);
} }

View File

@ -61,8 +61,8 @@ NON-STANDARD FEATURES
#ifdef SHARED_MODULE #ifdef SHARED_MODULE
/* global flag, TRUE if callback is used */ /* global flag, TRUE if callback is used */
extern bool wantevtdata; extern bool wantevtdata;
extern void shared_send_event(int, double, double, char *, void *, int); extern void shared_send_event(int, double, double, char *, void *, int, int);
extern void shared_send_dict(char*); extern void shared_send_dict(int, int, char*, char*);
static void EVTshareddump( static void EVTshareddump(
CKTcircuit *ckt, /* The circuit structure */ CKTcircuit *ckt, /* The circuit structure */
Ipc_Anal_t mode, /* The analysis mode for this call */ Ipc_Anal_t mode, /* The analysis mode for this call */
@ -403,8 +403,6 @@ static void EVTshareddump(
Evt_Node_Info_t **node_table; Evt_Node_Info_t **node_table;
char buff[10000];
Mif_Boolean_t equal; Mif_Boolean_t equal;
/* Get number of event-driven nodes */ /* Get number of event-driven nodes */
@ -474,16 +472,9 @@ static void EVTshareddump(
/* If this is the first call, send the dictionary (the list of event nodes, line by line) */ /* If this is the first call, send the dictionary (the list of event nodes, line by line) */
if (firstcall) { if (firstcall) {
for (i = 0; i < num_nodes; i++) { for (i = 0; i < num_nodes; i++) {
if (node_dict[i].send) { if (node_dict[i].send)
sprintf(buff, "%d %s %s", node_dict[i].ipc_index, shared_send_dict(node_dict[i].ipc_index, num_nodes, node_dict[i].node_name_str, node_dict[i].udn_type_str);
node_dict[i].node_name_str,
node_dict[i].udn_type_str);
/* send it directly to sharedspice.c */
shared_send_dict(buff);
}
} }
/* last entry to list */
shared_send_dict(NULL);
} }
/* If this is the first call, send the operating point solution */ /* If this is the first call, send the operating point solution */